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.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.BufferedWriter;
import java.io.Writer;
import java.util.Collections;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintWriter;
import java.io.OutputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alex
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskD {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt(), k = in.readInt();
            ArrayList<IntIntPair> al = new ArrayList<>();
            for(int i = 0; i < n; i++) {
                int left = in.readInt(), right = in.readInt();
                al.add(new IntIntPair(left, 0));
                al.add(new IntIntPair(right, 1));
            }
            Collections.sort(al);
            ArrayList<IntIntPair> res = new ArrayList<>();
            int count = 0, began = -11111;
            for(IntIntPair point : al) {
//            out.printLine(point.first, point.second);
                if(point.second == 0) {
                    count++;
                    if(count == k) {
                        began = point.first;
//                    out.printLine("BEGAN", began);
                    }
                } else {
                    count--;
                    if(count == k - 1) {
                        res.add(new IntIntPair(began, point.first));
                    }
                }
            }
            out.printLine(res.size());
            for(IntIntPair p : res) {
                out.printLine(p.first, p.second);
            }
//        int[] mem = new int[MAX * 2 + 1];
//        for(int i = 0; i < n; i++) {
//            int l = in.readInt(), r = in.readInt();
//            for(double j = l + 0.5; j <= r; j+=1) {
//                mem[(int) j + MAX]++;
//            }
//        }
//        ArrayList<Integer> res = new ArrayList<>();
//        for(int i = 0; i < mem.length; i++) {
//            int actindex = i - MAX;
//            if (mem[i] >= k) res.add(actindex);
//        }
//        ArrayList<ArrayList<Integer>> segs = new ArrayList<>();
//        for(int val : res){
//            boolean added = false;
//            if (!segs.isEmpty()){
//                ArrayList<Integer> last = segs.get(segs.size() - 1);
//                if (last.get(last.size() - 1) == val - 1){
//                    added = true;
//                    last.add(val);
//                }
//            }
//            if(!added) {
//                segs.add(new ArrayList<>());
//                segs.get(segs.size() - 1).add(val);
//            }
//        }
//        ArrayList<IntIntPair> ans = new ArrayList<>();
//        for(ArrayList<Integer> seg : segs) {
//            int left = seg.get(0);
//            int right = seg.get(seg.size() - 1) + 1;
//            ans.add(new IntIntPair(left, right));
//        }
//        Collections.sort(ans);
//        out.printLine(ans.size());
//        for(IntIntPair p : ans) {
//            out.printLine(p.first, p.second);
//        }
        }

    }

    static class IntIntPair implements Comparable<IntIntPair> {
        public final int first;
        public final int second;

        public IntIntPair(int first, int second) {
            this.first = first;
            this.second = second;
        }


        public boolean equals(Object o) {
            if(this == o) return true;
            if(o == null || getClass() != o.getClass()) return false;

            IntIntPair pair = (IntIntPair) o;

            return first == pair.first && second == pair.second;

        }


        public int hashCode() {
            int result = Integer.hashCode(first);
            result = 31 * result + Integer.hashCode(second);
            return result;
        }


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

        @SuppressWarnings({"unchecked"})
        public int compareTo(IntIntPair o) {
            int value = Integer.compare(first, o.first);
            if(value != 0) {
                return value;
            }
            return Integer.compare(second, o.second);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for(int i = 0; i < objects.length; i++) {
                if(i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if(numChars == -1)
                throw new InputMismatchException();
            if(curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch(IOException e) {
                    throw new InputMismatchException();
                }
                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while(isSpaceChar(c))
                c = read();
            int sgn = 1;
            if(c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if(c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while(!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if(filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

