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.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        FasterScanner s = new FasterScanner();
        PrintWriter out=new PrintWriter(System.out);
        int n=s.nextInt();
        int k=s.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        for(int i=0;i<n;i++){
        	a[i]=s.nextInt();
        	b[i]=s.nextInt();
        }
        Arrays.sort(a);
        Arrays.sort(b);
        int p1=0,p2=0;
        int cnt=0;
        int anscnt=0;
        int ansA[] = new int[n];
        int ansB[] = new int[n];
        for(int i=0;i<2*n;i++){
        	if( p2>=n || (p1<n && a[p1]<=b[p2])){
        		cnt++;
        		if(cnt==k)
        			ansA[anscnt]=a[p1];
        		p1++;
        	}
        	else{
        		cnt--;
        		if(cnt==k-1)
        			ansB[anscnt++]=b[p2];
        		p2++;
        	}
        }
        out.println(anscnt);
        for(int i=0;i<anscnt;i++)
        	out.println(ansA[i]+" "+ansB[i]);
        out.close();
    }
    
    
    
    
    
    
    
    
    
    
    
    
    static class Node
    {
    	int id=0;
    	char ch;
    	boolean done=false;
    	Node l,r;
    	int parent=0;
    	Node(char ch){ this.ch=ch;}
		
    }
    static int gcd (long m, long n){
        long x;
        long y;
        while(m%n != 0){
            x = n;
            y = m%n;
            m = x;
            n = y;
        }
        return (int) n;
    }

    
	public static class st {
	
	    static int n;
	    static int[] t;
	    static int [] pos;
	   
	    static void build(int n2,int[] b) {  // build the tree
	       t=b;
	       n=n2;
	       pos=new int[2*n];
	       for(int i=n;i<2*n;i++)
	       {
	    	   pos[i]=i-n;
	       }
	        for (int i = n - 1; i > 0; --i)
	        {
	        	if(t[pos[i<<1]]>t[pos[i<<1|1]])
	        		pos[i]=pos[i<<1];
	        	else
	        		pos[i]=pos[i<<1|1];
	        }
	    }
	
	    static void modify(int p, int value) {  // set value at position p
	      for (t[p += n] = value; p > 1; p >>= 1) t[p>>1] = Math.max(t[p] , t[p^1]);
	    }
	
	    static int query(int l, int r) {  // sum on interval [l, r)
	      long res=-1;
	      int p=0;
	      for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
	            if ((l&1)!=0) {
	            	if(res<t[pos[l]])
	            	{
	            		res=t[pos[l]];
	            		p=pos[l];
	            	}
	            	l++;
	            }
	            if ((r&1)!=0){
	            	r--;
	            	if(res<t[pos[r]])
	            	{
	            		res=t[pos[r]];
	            		p=pos[r];
	            	}
	            }
	          }
	      return p;
	    }
	}
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    public static class FasterScanner {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = System.in.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 nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        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 int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
      
        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

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

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