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 sun.java2d.loops.GeneralRenderer;

import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class Wtf {
    public static void main(String[] args) throws IOException {
        Ifmo ifmo = new Ifmo();
    }
}

class Ifmo {
    ArrayList<Integer> Graph[];
    int n, l, m, timer;
    char[][] field;
    ArrayList<FUCKINGVERTEX> Ribs;
    int[][] roofs, ans, up;
    Vertex[][] highes;
    ArrayList<Integer> fin;
    static int cur;
    int[] p, size, tin, tout;
    boolean[] used;
    int logn;
    int[][] longest;
    int[][][] dp = new int[31][31][51];
    ArrayList<Pair>[] tree;
    Ifmo() throws IOException {
        FScanner fs = new FScanner(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int n = fs.nextInt(), k = fs.nextInt();
        Pair[] lines = new Pair[n];
        for (int i = 0; i<n; i++)
            lines[i] = new Pair(fs.nextInt(), fs.nextInt());
        Arrays.sort(lines, new Comparator<Pair>() {
            @Override
            public int compare(Pair o1, Pair o2) {
                if (o1.x == o2.x)
                    return Integer.compare(o1.y, o2.y);
                else return Integer.compare(o1.x, o2.x);
            }
        });
        Lines[] Rot = new Lines[n*2];
        for (int i = 0; i<n; i++) {
            Rot[i*2] = new Lines(lines[i].x, true);
            Rot[i*2+1] = new Lines(lines[i].y, false);
        }
        Arrays.sort(Rot);
        ArrayList<Pair> ans = new ArrayList<>();
        int cStart = 0, cK = 0;
        for (int i = 0; i<Rot.length; i++) {
            if (Rot[i].start) {
                cK++;
                if (cK == k)
                    cStart = Rot[i].pos;
            } else {
                if (cK == k) {
                    ans.add(new Pair(cStart, Rot[i].pos));
                }
                cK--;
            }
        }

        pw.println(ans.size());
        for (Pair x : ans)
            pw.println(x.x + " " + x.y);
        pw.close();
    }

    void dfs_timer_lca(int v, int p, int c) {
        tin[v] = ++timer;
        up[v][0] = p;
        used[v] = true;
        for (int i = 1; i<logn; i++) {
            up[v][i] = up[up[v][i-1]][i-1];
        }

        for (int i = 0; i<tree[v].size(); i++)
            if (!used[tree[v].get(i).x]) {
                dfs_timer_lca(tree[v].get(i).x, v, tree[v].get(i).y);
            }
        tout[v] = timer++;
    }

    boolean upper(int a, int b) {
        return tin[a]<=tin[b] && tout[a]>=tout[b];
    }

    int lca(int a, int b) {
        if (upper(a, b)) return a;
        if (upper(b, a)) return b;
        for (int i = logn-1; i>=0; i--) {
            if (!upper(up[a][i], b))
                a = up[a][i];
        }
        return up[a][0];
    }



    int log_2(int g) {
        int s = 1;
        int ans = 0;
        while (g>=s)
        {
            ans++;
            s*=2;
        }
        return ans;
    }

    int dsu_get(int v) {
        return p[v] == v? v : (p[v] = dsu_get(p[v]));
    }

    void dsu_unit(int a, int b) { // a or dsu_get(a)? what's your choice?
        if (a!=b) {
            if (size[b]>size[a])
            {
                int q = a;
                a = b;
                b = q;
            }
            p[b] = a;
            size[a]+=size[b];
        }
    }
}

class Pair implements Comparable<Pair> {
    int x, y;
    Pair(int x1, int y1) {
        x = x1;
        y = y1;
    }

    @Override
    public int compareTo(Pair o) {
        return Integer.compare(x, o.x);
    }
}

class Lines implements Comparable<Lines> {
    int pos;
    boolean start;
    Lines(int x, boolean f) {
        pos = x;
        start = f;
    }

    @Override
    public int compareTo(Lines o) {
        if (pos == o.pos)
        {
            if (start == true && o.start == false)
                return -1;
            else if (start == true && o.start == true || start == false && o.start == false)
                return 0;
            else return 1;
        } else return Integer.compare(pos, o.pos);
    }
}

class Vertex implements Comparable<Vertex> {
    int a, b, c;
    Vertex(int a1, int b1, int c1) {
        a = a1;
        b = b1;
        c = c1;
    }

    @Override
    public int compareTo(Vertex o) {
        return Integer.compare(a, o.a);
    }
}

class FUCKINGVERTEX implements Comparable<FUCKINGVERTEX> {
    int a, b, c, d;
    FUCKINGVERTEX(int a1, int b1, int c1, int d1) {
        a = a1;
        b = b1;
        c = c1;
        d = d1;
    }

    @Override
    public int compareTo(FUCKINGVERTEX o) {
        return Integer.compare(a, o.a);
    }
}
class FScanner {
    StringTokenizer st;
    BufferedReader reader;
    FScanner(InputStreamReader isr) {
        reader = new BufferedReader(isr);
    }

    String nextLine() throws IOException {
        return reader.readLine();
    }

    String nextToken() throws IOException{
        while (st == null || !st.hasMoreTokens()) {
            String s = reader.readLine();
            if (s == null)
                return null;
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }

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

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

    char nextChar() throws IOException {
        return (char) reader.read();
    }


}
