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 unionofksegment {
    public static void main(String[] args) throws Exception
    {
        InputReader in=new InputReader(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        int n=in.nextInt();
        int k=in.nextInt();
        unionofksegment uk=new unionofksegment();
        pair[] arr=new pair[2*n];
        //pair[] x=new pair[n];
        int count=0;
        for(int i=0;i<n;i++)
        {
            arr[count]=uk.new pair(in.nextLong(),-1);
            arr[count+1]=uk.new pair(in.nextLong(),1);
            count+=2;
        }
        Arrays.sort(arr);
        ArrayList<pair> ans=new ArrayList<pair>();
        long left=0;
        long right=0;
         count=0;
        for(int i=0;i<2*n;i++)
        {
            if(arr[i].r==-1)
            {
                count++;
                if(count==k)
                {
                    left=arr[i].l;
                }
            }
            else if(arr[i].r==1)
            {
                count--;
                if(count==k-1)
                {
                    right=arr[i].l;
                    ans.add(uk.new pair(left,right));
                }
            }
        }
        pw.println(ans.size());
        for(int i=0;i<ans.size();i++)
        {
            pw.println(ans.get(i).l+" "+ans.get(i).r);
        }
        
        
        pw.close();
    }
    
    
    
    
    
    
    
    
     static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }
        
        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }
        
        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

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

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
     class pair implements Comparable<pair>
     {
        long l,r;
        public pair(long l,long r)
        {
            this.l=l;
            this.r=r;
        
        }
        public int compareTo(pair p1) {
            if(this.l!=p1.l)
            {
                return Long.compare(this.l, p1.l);
            }
            return Long.compare(this.r, p1.r);
        }
        
     }

}
