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.ArrayList;
import java.util.Collections;

/**
 * Created by Arthur on 3/14/2015.
 */
public class Main {

    AtomScanner sc;
    PrintWriter pw;

    public Main(AtomScanner sc, PrintWriter pw) {
        this.sc = sc;
        this.pw = pw;
        solve();
        close();
    }

    public static void main(String[] args) {
        new Main(new AtomScanner(System.in), new PrintWriter(System.out));
    }

    private void close() {
        sc.close();
        pw.close();
    }

    private void solveE() {
        int n = sc.nextInt();

    }

    private void solve() {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int l, r;
        ArrayList<Pi> list = new ArrayList<>();
        boolean started = false;
        int begin = -1;
        for (int i = 0; i < n; i++) {
            l = sc.nextInt();
            r = sc.nextInt();
            list.add(new Pi(l, 1));
            list.add(new Pi(r, 2));
        }
        Collections.sort(list);
        ArrayList<Pi> ans = new ArrayList<>();
        int now = 0;
        for (Pi x : list) {
            if (x.s == 1) {
                if (++now >= m && !started) {
                    started = true;
                    begin = x.f;
                }
            } else {
                if (--now < m && started) {
                    started = false;
                    ans.add(new Pi(begin, x.f));
                }
            }
        }
        pw.println(ans.size());
        ans.forEach(pw::println);
    }
}

class Pi implements Comparable<Pi> {

    int f, s;

    Pi(int f, int s) {
        this.f = f;
        this.s = s;
    }

    @Override
    public int compareTo(Pi pi) {
        if (f > pi.f) return 1;
        if (f < pi.f) return -1;
        if (s > pi.s) return 1;
        return s == pi.s ? 0 : -1;
    }

    @Override
    public String toString() {
        return f + " " + s;
    }
}

class Pl implements Comparable<Pl> {

    long f, s;

    Pl(long f, long s) {
        this.f = f;
        this.s = s;
    }

    Pl() {
        this(0, 0);
    }

    @Override
    public int compareTo(Pl pl) {
        if (f > pl.f) return 1;
        if (f < pl.f) return -1;
        if (s > pl.s) return 1;
        return s == pl.s ? 0 : -1;
    }

    @Override
    public String toString() {
        return "(" + f + "; " + s + ")";
    }
}

class Pair<F, S> {
    F first;
    S second;

    Pair(F first, S second) {
        this.first = first;
        this.second = second;
    }

    public int hashCode() {
        int hashFirst = first != null ? first.hashCode() : 0;
        int hashSecond = second != null ? second.hashCode() : 0;

        return (hashFirst + hashSecond) * hashSecond + hashFirst;
    }

    public boolean equals(Object other) {
        if (other instanceof Pair) {
            Pair otherPair = (Pair) other;
            return
                    ((this.first == otherPair.first ||
                            (this.first != null && otherPair.first != null &&
                                    this.first.equals(otherPair.first))) &&
                            (this.second == otherPair.second ||
                                    (this.second != null && otherPair.second != null &&
                                            this.second.equals(otherPair.second))));
        }

        return false;
    }

    public static <F extends Comparable, S extends Comparable> ArrayList<Pair<F, ArrayList<S>>> groupsPairs (ArrayList<Pair<F, S>> pairs) {
        ArrayList<Pair<F, ArrayList<S>>> result = new ArrayList<>();
        pairs.stream().sorted(Pair::compare).forEach(pair -> {
            if (result.isEmpty() || !pair.first.equals(result.get(result.size() - 1).first)) {
                result.add(new Pair<>(pair.first, new ArrayList<>()));
            }
            result.get(result.size() - 1).second.add(pair.second);
        });
        return result;
    }

    public static <F extends Comparable, S extends Comparable> int compare (Pair<F, S> a, Pair<F, S> b) {
        return a.first.compareTo(b.first) != 0 ? a.first.compareTo(b.first) : a.second.compareTo(b.second);
    }
}

class AtomScanner {

    final static int BUFFER_SIZE = 65536;

    BufferedReader br;
    char[] buf = new char[BUFFER_SIZE];
    int len = 0;
    int it = 0;
    boolean end = false;

    boolean delim(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    void fillBuffer() {
        try {
            len = br.read(buf);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void ensureBuffer() {
        if (it == len) {
            it = 0;
            fillBuffer();
            if (len == -1) end = true;
        }
    }

    void moveNext() {
        while (!end) {
            ensureBuffer();
            if (!delim(buf[it])) return;
            while (it < len && delim(buf[it])) it++;
        }
    }

    char nextChar() {
        moveNext();
        if (end) throw new NullPointerException("End was reached");
        return buf[it++];
    }

    String next() {
        moveNext();
        StringBuilder sb = new StringBuilder();
        while (!end) {
            int l = it;
            while (++it < len && !delim(buf[it]));
            sb.append(buf, l, it - l);
            ensureBuffer();
            if (delim(buf[it])) break;
        }
        return sb.toString();
    }

    int nextInt() {
        moveNext();
        boolean e = false;
        if (buf[it] == '-') {
            e = true;
            it++;
            ensureBuffer();
        }
        int result = 0;
        while (!end) {
            int l = it;
            while (it < len && !delim(buf[it])) {
                result = (result * 10) + buf[it] - '0';
                it++;
            }
            ensureBuffer();
            if (end || delim(buf[it])) break;
        }
        if (e) result *= -1;
        return result;
    }
    long nextLong() {
        moveNext();
        long result = 0;
        while (!end) {
            int l = it;
            while (it < len && !delim(buf[it])) {
                result = (result * 10) + buf[it] - '0';
                it++;
            }
            ensureBuffer();
            if (delim(buf[it])) break;
        }
        return result;
    }

    AtomScanner(String file) {
        try {
            br = new BufferedReader(new FileReader(file), BUFFER_SIZE);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    AtomScanner(InputStream is) {
        br = new BufferedReader(new InputStreamReader(is), BUFFER_SIZE);
    }

    public void close() {
        try {
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}