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
/**
 * Created by icon on 1/14/2016.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;


public class CF612D {
    public static void main(String[] args) {
        InputStream input = System.in;
        OutputStream output = System.out;
        Reader in = new Reader(input);
        PrintWriter out = new PrintWriter(output);
        Task magician = new Task();
        magician.solve(in, out);
        out.close();
    }

    static class Task {
        public void solve(Reader in, PrintWriter out) {
            int n = in.nextInt(), k = in.nextInt();
            Pair[] ar = new Pair[n + n];
            Pair[] res = new Pair[n + n];
            Stack<Integer> stack = new Stack<Integer>();
            for(int i = 0; i < n; i++) {
                ar[i] = new Pair(in.nextInt(), 1);
                ar[i + n] = new Pair(in.nextInt(), 2);
            }
            Arrays.sort(ar, new Comparator<Pair>() {
                @Override
                public int compare(Pair p, Pair q) {
                    if(Integer.compare(p.first, q.first) == 0) return Integer.compare(p.second, q.second);
                    return Integer.compare(p.first, q.first);
                }
            });
            int cur = 0, size = 0;
            for(int i = 0; i < n + n; i++) {
                if(ar[i].second == 1) {
                    cur++;
                    stack.push(ar[i].first);
                } else {
                    if(cur == k) {
                        res[size++] = new Pair(stack.peek(), ar[i].first);
                    }
                    cur--;
                    stack.pop();
                }
            }
            out.println(size);
            for(int i = 0; i < size; i++) {
                out.println(res[i]);
            }
        }
    }

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

        public String toString() {
            return first + " " + second;
        }
    }

    static class Reader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public Reader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

