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.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.Arrays;
import java.util.StringTokenizer;

// Educational Codeforces Round 4
// The Union of k-Segments
public class Problem_612_D {
    

    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Problem_612_D solver = new Problem_612_D();
        solver.solve(1, new InputStreamReader(inputStream), out);
        out.close();
    }

    static class Pair implements Comparable<Pair> {
      int first;

      int second;

      Pair(int f, int s)
      {
        first = f;
        second = s;
      }

      public int compareTo(Pair o)
      {
        int r = first - o.first;

        if(r == 0)
          r = second - o.second;

        return r;
      }
    }
    
    public void solve(int test, Reader input, PrintWriter out)
    {
        MyScanner in = new MyScanner(input);
        
        int n = in.nextInt();
        int k = in.nextInt();
        
        Pair[] events = new Pair[2*n];
        
        for(int i = 0; i < n; i++) {
          events[i*2] = new Pair(in.nextInt(), 0);
          events[i*2+1] = new Pair(in.nextInt(), 1);
        }
        Arrays.sort(events);
        
        int[] l = new int[n];
        int[] r = new int[n];
        
        int index = 0;
        int count = 0;
        
        for(Pair event : events) {
          if(event.second == 0) {
            count++;
            if(count == k) {
              l[index] = event.first;
            }
          } else {
            if(count == k) {
              r[index++] = event.first;
            }
            count--;
          }
        }
        if(count >= k)
          r[index++] = events[2*n - 1].first;
        out.println(index);
        for(int i = 0; i < index; i++)
          out.println(l[i] + " " + r[i]);
        
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner(Reader reader) {
            br = new BufferedReader(reader);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        
        int[] nextIntArray(int n)
        {
            int[] r = new int[n];
            for(int i = 0; i < n; i++)
                r[i] = nextInt();
            return r;
        }

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------

}
