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.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        QuickScanner in = new QuickScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    public void solve(int testNumber, QuickScanner in, PrintWriter out) {
        int n=in.nextInt();
        int k=in.nextInt();
        int a[]=new int[n];
        int b[]=new int[n];
        int minValue=Integer.MAX_VALUE;
        for(int i=0;i<n;i++)
        {
            a[i]=in.nextInt();
            b[i]=in.nextInt();
            minValue=Math.min(a[i], minValue);
        }
        for(int i=0;i<n;i++)
        {
            a[i] -= minValue;
            b[i] -= minValue;
        }
        long event[]=new long[2*n];
        int top=0;
        for(int i=0;i<n;i++)
        {
            event[2*i]=((long)a[i])*2;
            event[2*i+1]=((long)b[i])*2+1;
        }
        Random rand=new Random();
        Utils.randomShuffle(event,rand);
        Arrays.sort(event);
        ArrayList<Integer> beg=new ArrayList<Integer>(), end=new ArrayList<Integer>();
        int balance=0;
        for(int i=0;i<2*n;i++)
        {
            if(event[i]%2==0) // start
            {
                balance++;
                if(balance==k)
                    beg.add((int) (event[i]/2));
            }
            else //end
            {
                balance--;
                if(balance==k-1)
                    end.add((int) (event[i]/2));
            }
        }
        out.println(beg.size());
        for(int i=0;i<beg.size();i++)
        {
            out.print(beg.get(i)+minValue);
            out.print(" ");
            out.println(end.get(i)+minValue);
        }

    }
}

class QuickScanner {
    BufferedReader in;
    StringTokenizer token;
    String delim;
    public QuickScanner(InputStream inputStream)
    {
        this.in=new BufferedReader(new InputStreamReader(inputStream));
        this.delim=" \n\t";
        this.token=new StringTokenizer("",delim);
    }

    public boolean hasNext()
    {
        while(!token.hasMoreTokens())
        {
            try {
                String s=in.readLine();
                if(s==null) return false;
                token=new StringTokenizer(s,delim);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }
        return true;
    }

    public String next()
    {
        hasNext();
        return token.nextToken();
    }

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

}

class Utils {

    static public void swap(long[] a, int i, int j)
    {
        long t=a[i];
        a[i]=a[j];
        a[j]=t;
    }


    static public void randomShuffle(long [] a, Random rand) {
        int n=a.length;
        for(int i=0;i<n;i++)
        {
            int id=rand.nextInt(n-i)+i;
            swap(a,i,id);
        }
    }

}
