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.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
import java.util.TreeSet;

public class q4 
{

    public static void main(String arsgp[])
    {
        FasterScanner s=new FasterScanner();
        int n=s.nextInt();
        int k=s.nextInt();
        int max=(int)(1e6+10);
        int h[]=new int[2*n];
        pair[] p=new pair[n];
        for(int i=0;i<n;i++)
        {
            int s1=s.nextInt();
            int e=s.nextInt();
            p[i]=new pair(s1,e);
            h[2*i]=s1;
            h[2*i+1]=e;
        }
        Arrays.sort(h);
        
        int ans[]=new int[2*max];
        int tmp[]=new int[2*max];
        for(int i=0;i<n;i++)
        {
            int i1=ser(h, p[i].s,0,h.length-1);

            int i2=ser(h, p[i].e,0,h.length-1);
        //  System.out.println(i1+" "+i2+" "+p[i].s+" "+p[i].e+"   a");

//          int i1=Arrays.binarySearch(h, p[i].s);
//          int i2=Arrays.binarySearch(h, p[i].e);
            
            
            ans[i1]+=1;ans[i2]+=-1;
            tmp[i2+1]--;
            tmp[i1]++;
        }
        
        for(int i=1;i<2*max;i++)
        {
            ans[i]=ans[i-1]+ans[i];
            tmp[i]=tmp[i-1]+tmp[i];
        }
        
        StringBuilder fans=new StringBuilder();
        
        int i1=0,i2=0;
//      System.out.println(Arrays.toString(ans));
//      System.out.println(Arrays.toString(h));
//
//      System.out.println(Arrays.toString(tmp));
        int c=0;
        for(int i=0;i<2*n;i++)
        {
            if(tmp[i]<k)
                {
                
                continue;
                }
            else
            {
                i1=i;
                while(ans[i1]>=k)
                    i1++;
                c++;
                fans.append(h[i]+" "+h[i1]+"\n");
                i=i1;
            }
        }
//      while(i1<2*n && i2<2*n)
//      {
//  //      System.out.println(i1+" "+i2+" "+h[i1]+ " "+h[i2]+" "+ans[i1]+" "+ans[i2]);
//          if(i1==i2 && ans[i1]<k)
//          {
//              
//              if(tmp[i1]>=k)
//              {
//                  c++;
//                  fans.append(h[i1]+" "+h[i2]+"\n");
//                  
//              }
//              
//              i1++;i2++;
//          }
////            else if(i1==i2 && tmp[i1]>=k)
////            {
////                c++;
////                fans.append(h[i1]+" "+h[i2]+"\n");
////                i1++;i2++;
////            }
//          else
//          {
//              if(i1==i2 && tmp[i1]>=k)
//              {
//                  c++;
//                  fans.append(h[i1]+" "+h[i2]+"\n");
//              }
//              if(ans[i2]>=k)
//              {
//                  i2++;
//              }
//              else
//              {
//                  fans.append(h[i1]+" "+h[i2]+"\n");
//              
//                  i2++;
//                  i1=i2;
//                  
//                  c++;
//              }
//          }
//      }
        System.out.println(c);
        System.out.println(fans);
    }
    
    static class pair implements Comparable<pair>
    {
        int s,e;
        public pair(int s, int e)
        {
            this.s=s;
            this.e=e;
        }
        @Override
        public int compareTo(pair o) {
            // TODO Auto-generated method stub
            return 0;
        }
    }
    
    
    public static int ser(int[] arr,int k,int a,int b)
    {
        if(b-a<2)
        {
            if(arr[b]==k)
                return b;
            else
                if(arr[a]==k)
                    return a;
                else
                    return -1;
        }
        else
        {
            int mid=(a+b)/2;
            if(arr[mid]==k && arr[mid+1]!=k)
                return mid;
            else
                if(arr[mid]>k)
                    return ser(arr,k,a,mid);
                else
                    return ser(arr,k,mid,b);
        }
    }
    
    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;
        }
    }

    
    
}
