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.*;
import java.util.*;
public class D612 {
    int val,ind;
    public D612(int v,int i)
    {
        this.val=v;
        this.ind=i;
    }
    public static void main(String args[])throws IOException
        {
            Reader sc=new Reader();
            PrintWriter pw=new PrintWriter(System.out);
            int n=sc.nextInt();
            int k=sc.nextInt();
            D612 arr[]=new D612[2*n];
            for(int i=0;i<n;i++)
            {
                arr[2*i]=new D612(sc.nextInt(),0);
                arr[2*i + 1]=new D612(sc.nextInt(),1);
            }
            Arrays.sort(arr,new Comparator<D612>(){
               public int compare(D612 ob1,D612 ob2)
               {
                   if(ob1.val!=ob2.val)
                    return Integer.compare(ob1.val,ob2.val);
                   else
                       return Integer.compare(ob1.ind,ob2.ind);
               }
            });
            List<Integer> open=new ArrayList<>();
            List<Integer> close=new ArrayList<>();
            int c=0,inf=Integer.MIN_VALUE;
            int st=inf;
            for(int i=0;i<2*n;i++)
            {
                if(arr[i].ind==0)
                {
                    c++;
                }
                else
                    c--;
                if(c>=k)
                {
                    if(st==inf)
                        st=arr[i].val;
                }
                else
                {
                    if(st!=inf)
                    {
                        open.add(st);
                        close.add(arr[i].val);
                        st=inf;
                    }
                }
            }
            if(st!=inf)
            {
                open.add(st);
                close.add(arr[n-1].val);
            }
            if(open.size()==0)
            {
                pw.println(0);
                pw.close();
                System.exit(0);
            }
            if(open.size()==1)
            {
                pw.println(1);
                pw.println(open.get(0)+" "+close.get(0));
                pw.close();
                System.exit(0);
            }
            List<D612> list=new ArrayList<>();
            int start=open.get(0),end=close.get(0);
            for(int i=1;i<open.size();i++)
            {
                if(open.get(i)==end)
                    end=close.get(i);
                else
                {
                    list.add(new D612(start,end));
                    start=open.get(i);
                    end=close.get(i);
                }
            }
            list.add(new D612(start,end));
            pw.println(list.size());
            for(int i=0;i<list.size();i++)
            {
                pw.println(list.get(i).val+" "+list.get(i).ind);
            }
            pw.close();
        }

}
class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte [] buffer;
		private int bufferPointer, bytesRead;
		
		public Reader () {
			din = new DataInputStream (System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		
		public Reader (String file_name) throws IOException {
			din = new DataInputStream (new FileInputStream (file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		
		public String readLine () throws IOException {
			byte [] buf = new byte[1024];
			int cnt = 0, c;
			while ((c = read ()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String (buf, 0, cnt);
		}
		
		public int nextInt () throws IOException {
			int ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		
		public long nextLong () throws IOException {
			long ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		
		public double nextDouble () throws IOException {
			double ret = 0, div = 1;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read ()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		
		private void fillBuffer () throws IOException {
			bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		
		private byte read () throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer ();
			return buffer[bufferPointer++];
		}
		
		public void close () throws IOException {
			if (din == null)
				return;
			din.close ();
		}
	}

