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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, Reader in, PrintWriter out) {
            int n = in.ni();
            int k = in.ni();
            PairInt[] segments = new PairInt[n];
            for (int i = 0; i < n; i++) {
                segments[i] = new PairInt(in.ni(), in.ni());
            }
            Arrays.sort(segments, new Comparator<PairInt>() {

                public int compare(PairInt o1, PairInt o2) {
                    if (o1.x == o2.x) {
                        return o1.y - o2.y;
                    }
                    return o1.x - o2.x;
                }
            });

            PairInt[] segmentsRight = new PairInt[n];
            System.arraycopy(segments, 0, segmentsRight, 0, n);
            Arrays.sort(segmentsRight, new Comparator<PairInt>() {

                public int compare(PairInt o1, PairInt o2) {
                    return o1.y - o2.y;
                }
            });
            int num = 0;
            int left, right;
            left = right = 0;
            int leftBorder = Integer.MIN_VALUE;
            ArrayList<PairInt> result = new ArrayList<>();
            while (left < n) {
                int j = left;
                for (; j < n && segments[left].x == segments[j].x; j++) {
                }

                int z = right;
                for (; z < n && segmentsRight[z].y < segments[left].x; z++) {
                    --num;
                    if (num == k - 1) {
                        result.add(new PairInt(leftBorder, segmentsRight[z].y));
                        leftBorder = Integer.MIN_VALUE;
                    }
                }
                if (num < k && (num + j - left) >= k) {
                    leftBorder = segments[left].x;
                }
                num += j - left;
                left = j;
                right = z;
            }
            if (num >= k) {
                for (; right < n; right++) {
                    --num;
                    if (num == k - 1) {
                        result.add(new PairInt(leftBorder, segmentsRight[right].y));
                        break;
                    }
                }
                if (num >= k) {
                    result.add(new PairInt(leftBorder, segmentsRight[n - 1].y));
                }
            }
            out.println(result.size());
            for (PairInt pairInt : result) {
                out.println(pairInt.x + " " + pairInt.y);
            }
        }

    }

    static class PairInt {
        public int x;
        public int y;

        public PairInt(int x, int y) {
            this.x = x;
            this.y = y;
        }


        public boolean equals(Object obj) {
            PairInt pairInt = (PairInt) obj;
            return pairInt.x == x && pairInt.y == y;
        }

        public String toString() {
            return x + " " + y;
        }

        public PairInt clone() {
            return new PairInt(x, y);
        }

    }

    static class Reader {
        private BufferedReader in;
        private StringTokenizer st = new StringTokenizer("");
        private String delim = " ";

        public Reader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(rl());
            }
            return st.nextToken(delim);
        }

        public String rl() {
            try {
                return in.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}

