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.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class D{

    static final int dummy = -(int)2e9;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        StringBuilder sb = new StringBuilder();
        int n = sc.nextInt(), k = sc.nextInt();
        PriorityQueue<Segment> open = new PriorityQueue<Segment>();
        PriorityQueue<Segment> close = new PriorityQueue<Segment>(new Closer());
        ArrayList<Segment> ans = new ArrayList<Segment>(n);
        while(n-->0)
            open.add(new Segment(sc.nextInt(), sc.nextInt()));
        int curIn = 0, newOpen = dummy;
        while(!open.isEmpty() || !close.isEmpty())
        {
            if(close.isEmpty() || !open.isEmpty() && open.peek().b <= close.peek().e)
            {
                curIn++;
                Segment s = open.remove();
                close.add(s);
                if(newOpen == dummy && curIn >= k)
                    newOpen = s.b;
            }
            else
            {
                curIn--;
                Segment s = close.remove();
                if(newOpen != dummy && curIn < k)
                {
                    ans.add(new Segment(newOpen, s.e));
                    newOpen = dummy;
                }
            }
        }
        int m = ans.size();
        out.println(m);
        for(Segment s: ans)
            sb.append(s.b).append(" ").append(s.e).append("\n");
        out.print(sb);
        out.flush();
        out.close();
    }
    
    static class Segment implements Comparable<Segment>
    {
        int b, e;
        
        Segment(int x, int y) { b = x; e = y; }
        
        public int compareTo(Segment s)
        {
            return b - s.b;
        }
    }
    
    static class Closer implements Comparator<Segment>
    {
        public int compare(Segment s1, Segment s2)
        {
            return s1.e - s2. e;
        }
    }

    static class Scanner 
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader fileReader) throws FileNotFoundException{ br = new BufferedReader(fileReader);}

        public Scanner(InputStream s) throws FileNotFoundException{ br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException 
        {
            while (st == null || !st.hasMoreTokens()) 
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public double nextDouble() throws IOException
        {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if(x.charAt(0) == '-')
            {
                neg = true;
                start++;
            }
            for(int i = start; i < x.length(); i++)
                if(x.charAt(i) == '.')
                {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                }
                else
                {
                    sb.append(x.charAt(i));
                    if(dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg?-1:1);
        }


        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public boolean ready() throws IOException {return br.ready(); }


    }

}
