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
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
//     Test.testing();
        ConsoleIO io = new ConsoleIO();
        new Main(io).solve();
        io.flush();
    }
    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }

    ArrayList<ArrayList<Edge>> gr1;
    ArrayList<ArrayList<Integer>> gr2;
    boolean[] visit;
    //

    class Edge{
        public Edge(int u,int v) {
            this.u = u;
            this.v = v;
        }
        public int u;
        public int v;
    }

    int n,m,k,fn;
    public void solve() {
        int[] l  = io.readIntArray();
        n = l[0];k = l[1];
        Edge[] all = new Edge[n+n];
        for(int i =  0;i<n;i++) {
            l = io.readIntArray();

            all[i * 2] = new Edge(l[0], 0);
            all[i * 2 + 1] = new Edge(l[1], 1);
        }
        Arrays.sort(all, (e1,e2)->e1.u==e2.u?e1.v-e2.v:e1.u-e2.u);
        ArrayList<Edge> res = new ArrayList<>();
        int depth = 0;
        int a= 0,b=0;
        boolean open = false;
        for(int i  = 0;i<all.length;i++) {
            Edge e = all[i];
            if (e.v == 0) depth++;
            else depth--;
            if (!open && depth >= k) {
                open = true;
                a = e.u;
            } else if (open && depth < k) {
                open = false;
                res.add(new Edge(a, e.u));
            }
        }
        io.writeLine("" + res.size());
        for(int i = 0;i<res.size();i++)
            io.writeLine(res.get(i).u + " " + res.get(i).v);
    }

}

class ConsoleIO {
    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}
    public void flush(){this.out.close();}
    public void writeLine(String s) {this.out.println(s);}
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long readLong() {
        return Long.parseLong(this.readLine());
    }
    public int readInt() {
        return Integer.parseInt(this.readLine().trim());
    }
    public long[] readLongArray() {
        String[]n=this.readLine().trim().split(" ");long[]r=new long[n.length];
        for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);
        return r;
    }
    public int[] readIntArray() {
        String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
}

