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 PA {
    public static void main(String[] args) {
//        long start = System.currentTimeMillis();
        new PA().run();
//        System.out.println();
//        System.out.println((System.currentTimeMillis() - start) / 1000.0);
    }

    private void run() {
        FastScanner sc = new FastScanner();
        StringBuilder out = new StringBuilder();

        int n = sc.nextInt(), k = sc.nextInt();
        Segment[] ll = new Segment[n], rr = new Segment[n];
        for (int i = 0; i < n; i++) {
            Segment segment = new Segment(sc.nextInt(), sc.nextInt());
            ll[i] = segment;
            rr[i] = segment;
        }
        Arrays.sort(ll, Comparator.comparingInt(o -> o.l));
        Arrays.sort(rr, Comparator.comparingInt(o -> o.r));

        int lli = 0, rri = 0;
        int depth = 0;
        int x;
//        List<Segment> answer = new ArrayList<>();
        int count = 0;
        Segment last = null;
        while (lli < ll.length || rri < rr.length) {
            x = Math.min(
                    lli < ll.length ? ll[lli].l : Integer.MAX_VALUE,
                    rri < rr.length ? rr[rri].r : Integer.MAX_VALUE);

            while (lli < ll.length && ll[lli].l == x) {
                depth++;
                lli++;
            }

            if (depth >= k) {
                if (last == null) {
                    last = new Segment(x, x);
                    count++;
//                    answer.add(last);
                }
                last.r = x;
            } else if (last != null) {
                out.append(last);
                out.append("\n");
                last = null;
            }

            while (rri < rr.length && rr[rri].r == x) {
                depth--;
                rri++;
            }

            if (depth >= k) {
                if (last == null) {
                    last = new Segment(x, x);
                    count++;
//                    answer.add(last);
                }
                last.r = x;
            } else if (last != null) {
                out.append(last);
                out.append("\n");
                last = null;
            }
        }
        if (last != null) {
            out.append(last);
            out.append("\n");
        }

        System.out.println(count);
//        System.out.println(answer.size());
//        for (Segment s : answer) {
//            out.append(s);
//            out.append("\n");
//        }
        System.out.println(out);
    }

    private static class Segment {
        int l, r;

        public Segment(int l, int r) {
            this.l = l;
            this.r = r;
        }

        @Override
        public String toString() {
            return l + " " + r;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

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

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