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 on 14/11/19 11:17 AM*******
 */

import java.io.*;
import java.util.*;

public class D612Ed4 implements Runnable {

    private static final int MAX = (int) 1e5 + 10;
    private static final int MOD = (int) 1e9 + 7;
    class Pair{
        int a;
        int b;
        Pair(int a, int b){
            this.a =a;
            this.b =b;
        }
    }
    private void solve() throws IOException {
        int n = reader.nextInt();
        int k = reader.nextInt();
        List<Pair> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            list.add(new Pair(reader.nextInt(), -1));
            list.add(new Pair(reader.nextInt(), 1));
        }
        Collections.sort(list, new Comparator<Pair>() {
            @Override
            public int compare(Pair o1, Pair o2) {
                if(o1.a != o2.a)
                    return Integer.compare(o1.a, o2.a);
                return Integer.compare(o1.b, o2.b);
            }
        });

        List<Pair> ans = new ArrayList<>();
        int cur =0;
        for(int i=0;i < list.size();i++){
            cur -= list.get(i).b;
            if(cur >=k){
                int len = ans.size();
                if(ans.isEmpty() || ans.get(len-1).b < list.get(i).a)
                    ans.add(new Pair(list.get(i).a, list.get(i+1).a));
                else {
                    Pair temp = ans.get(len-1);
                    ans.remove(len-1);
                    ans.add(new Pair(temp.a, Math.max(list.get(i+1).a, temp.b )));
                }
            }
        }
        writer.println(ans.size());
        for(int i=0;i<ans.size();i++){
            writer.println(ans.get(i).a +" "+ans.get(i).b);
        }
    }

    public static void main(String[] args) throws IOException {
        try (Input reader = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {
            new D612Ed4().run();
        }
    }

    StandardInput reader;
    PrintWriter writer;

    @Override
    public void run() {
        try {
            reader = new StandardInput();
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    interface Input extends Closeable {
        String next() throws IOException;

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

        default long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        default int[] readIntArray() throws IOException {
            return readIntArray(nextInt());
        }

        default int[] readIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        default long[] readLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextLong();
            }
            return array;
        }
    }

    private static class StandardInput implements Input {
        private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        private StringTokenizer stringTokenizer;

        @Override
        public void close() throws IOException {
            reader.close();
        }

        @Override
        public String next() throws IOException {
            if (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                stringTokenizer = new StringTokenizer(reader.readLine());
            }
            return stringTokenizer.nextToken();
        }
    }
}
