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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class D {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static class Sort implements Comparable<Sort> {
        int x, t;
        public int compareTo(Sort arg0) {
            if (this.x==arg0.x)
                return this.t-arg0.t;
            return this.x-arg0.x;
        }
    }
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int k = nextInt();
        Sort[]a = new Sort[2*n+1];
        for (int i = 1; i <= n; i++) {
            a[2*i-1] = new Sort();
            a[2*i-1].x = nextInt();
            a[2*i-1].t = 1;
            a[2*i] = new Sort();
            a[2*i].x = nextInt();
            a[2*i].t = 2;
        }
        Arrays.sort(a, 1, 2*n+1);
        int[]x = new int[2*n+1], t = new int[2*n+1];
        for (int i = 1; i <= 2*n; i++) {
            x[i] = a[i].x;
            t[i] = a[i].t;
        }
        int all = 0;
        int[]L = new int[2*n+1], R = new int[2*n+1];
        int ans = 0;
        for (int i = 1; i <= 2*n; i++) {
            int right = i;
            int open = 0;
            int close = 0;
            boolean found = false;
            if (all >= k) {
                R[ans] = x[i];
                found = true;
            }
            if (t[i]==1)
                open++;
            else
                close++;
            while (right < 2*n && x[right+1]==x[i]) {
                right++;
                if (t[right]==1)
                    open++;
                else
                    close++;
            }
            all += open;
            if (all >= k && !found) {
                ans++;
                L[ans] = x[i];
                R[ans] = x[i];
            }
            all -= close;
            i = right;
        }
        pw.println(ans);
        for (int i = 1; i <= ans; i++) {
            pw.println(L[i]+" "+R[i]);
        }
        pw.close();
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}
