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.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        //Scanner sc = new Scanner();
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();
 
    }
 
    static int log2(int a){
        return (int)(Math.log(n)/Math.log(2));
    }
 
    static int INF = (int)1e9+5;
    static int maxn = (int)1e4+5;
    static long mod=(int)1e9+7 ;
    static int n,m,k,t,q;
    
    
    void solve(PrintWriter out, Reader in) throws IOException{   
        n = in.nextInt();
        k = in.nextInt();
        
        
        ArrayList<Node> arr = new ArrayList<>();
        for(int i=0;i<n;i++){
            arr.add(new Node(in.nextInt(),strt));
            arr.add(new Node(in.nextInt(),end));
        }
        
        Collections.sort(arr);
        
        ArrayList<Node> ans = new ArrayList<>();
        int cnt=0,start=INF,prev=INF,curr=0,lastm=0;
        boolean flag = false;
        for(int i=0;i<arr.size();i++){
            curr = arr.get(i).v;
            
            if(arr.get(i).s==strt) {cnt++;lastm=arr.get(i).v;}
            else cnt--;
            
            if(cnt>=k && !flag) {
                flag= true;
                start = curr;
            }
            
            if(cnt<k && flag){
                ans.add(new Node(start,curr));
                start = INF;
                if(cnt>0) start = lastm;
                flag = false;
            }
            
        }
        
        
        out.println(ans.size());
        for(int i=0;i<ans.size();i++)
            out.println(ans.get(i).v+" "+ans.get(i).s);
        
    }
    
    static int strt=1,end=-1;
    static class Node implements Comparable<Node>{
        int v,s;
        
        Node(int v,int s){
            this.v = v;
            this.s = s;
        }
        
        public int compareTo(Node o){
            if(this.v!=o.v) return this.v-o.v;
            return o.s-this.s;
        }
    }
    
    //<>
    
    static class Reader {

    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public Reader() {
        this(System.in);
    }

    public Reader(InputStream is) {
        mIs = is;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();

    }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = mIs.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public String next() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    }
}