You are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at least k segments. Find the smallest (by the number of segments) set of segments on the coordinate axis Ox which contains all satisfied points and no others.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 106) — the number of segments and the value of k.

The next n lines contain two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109) each — the endpoints of the i-th segment. The segments can degenerate and intersect each other. The segments are given in arbitrary order.

Output

First line contains integer m — the smallest number of segments.

Next m lines contain two integers aj, bj (aj ≤ bj) — the ends of j-th segment in the answer. The segments should be listed in the order from left to right.

Examples

Input

3 2
0 5
-3 2
3 8


Output

2
0 2
3 5


Input

3 2
0 5
-3 3
3 8


Output

1
0 5
//package codeforce;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;

public class P612DTest2 {

    public static class Record{
        int point;
        int status;
        public Record(int point, int status){
            this.point = point;
            this.status = status;
        }

        public int compare(Record r){
            if (this.point < r.point){
                return -1;
            } else if (this.point > r.point){
                return 1;
            } else if (this.status == -1){
                return -1;
            } else if (r.status == -1){
                return 1;
            } else {
                return 0;
            }
        }

        public String toString(){
            return this.point+" "+this.status;
        }
    }

    public static class Interval{
        int start;
        int end;

        public Interval(int start, int end){
            this.start = start;
            this.end = end;
        }

        public String toString(){
            return this.start + " " + this.end;
        }
    }

    public static class FastScanner{
        private BufferedReader bi;
        String line;
        public FastScanner(){
            this.bi = new BufferedReader(new InputStreamReader(System.in));
        }

        public int[] readIntPair() {
            try {
                this.line = this.bi.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            String[] spl = this.line.split("\\s");
            return new int[]{Integer.parseInt(spl[0]), Integer.parseInt(spl[1])};
        }
    }

    static Record[] a;
    static Random r;
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        r = new Random();
        int[] pp = sc.readIntPair();
        int n = pp[0];
        int k = pp[1];

//        int n = 999999;
//        int k = 3;

        Record[] lefts = new Record[n];
        Record[] rights = new Record[n];
        for (int i = 0; i < n; i++){
            pp = sc.readIntPair();
			lefts[i] = new Record(pp[0], -1);
            rights[i] = new Record(pp[1], 1);
//			lefts[i] = new Record(i*2, -1);
//            rights[i] = new Record(100000001, 1);
        }
//        Comparator<Record> com = new Comparator<Record>() {
//            @Override
//            public int compare(Record o1, Record o2) {
//                if (o1.point < o2.point){
//                    return -1;
//                } else if (o1.point > o2.point){
//                    return 1;
//                } else if (o1.status == -1){
//                    return -1;
//                } else if (o2.status == -1){
//                    return 1;
//                } else {
//                    return 0;
//                }
//            }
//        };
        lefts = sortArray(lefts);
        rights = sortArray(rights);
//        Arrays.sort(lefts, com);
//        Arrays.sort(rights, com);
        int count = 0;
        int left = 0;
        ArrayList<Interval> ans = new ArrayList<Interval>(n);

        int x = 0;
        int y = 0;
        Record current;
        for (int i = 0, l = 2*n; i < l; i++){
            if (x >= n){
                current = rights[y++];
            } else if (y >= n){
                current = lefts[x++];
            } else {
                Record o1 = lefts[x];
                Record o2 = rights[y];
                if (o1.compare(o2) == -1){
                    current = o1;
                    x++;
                } else {
                    current = o2;
                    y++;
                }
            }
            count -= current.status;
            if (count == k && count+current.status == k-1){
                left = current.point;
            } else if (count == k-1 && count+current.status == k){
                ans.add(new Interval(left, current.point));
            }
        }

        out.write(ans.size()+"\n");
		for (Interval in : ans){
			out.write(in.toString()+"\n");
		}
        out.flush();;
        out.close();
        long end = System.currentTimeMillis();
//        System.out.println(end-start);
    }

    public static Record[] sortArray(Record[] array){
        a = array;
//        sort(0, array.length - 1);
        return executeMergeSort(array, 0, array.length);
    }


	protected static Record[] executeMergeSort(Record[] arr, int left, int right) {

		int mid = (int) ((right + left) / 2);
		if (left + 1 == right) {
			return new Record[]{ arr[mid] };
		}
		Record[] arr1 = executeMergeSort(a, left, mid);
		Record[] arr2 = executeMergeSort(a, mid, right);

		return combineSorted(arr1, arr2);
	}

	protected static Record[] combineSorted(Record[] a, Record[] b) {
		int n = a.length + b.length;
		int i = 0, j = 0;
		Record[] res = new Record[n];
		for (int k = 0; k < n; k++) {
			if (i >= a.length) {
				res[k] = b[j++];
			} else if (j >= b.length) {
				res[k] = a[i++];
			} else if (a[i].compare(b[j]) == 1) {
				res[k] = b[j++];
			} else {
				res[k] = a[i++];
			}
		}
		return res;
	}
}
