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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class D {	
	int n,k;
	int l[], r[];
	int fenwick[];
	void readInput() throws NumberFormatException, IOException{
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		/*
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		k = sc.nextInt();
		l = new int[n];
		r = new int[n];
		for(int i=0; i<n; i++){
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}
		*/
		InputStream inputStream = System.in;		
		InputReader in = new InputReader(inputStream);
		n = in.nextInt();
		k = in.nextInt();
		l = new int[n];
		r = new int[n];
		for(int i=0; i<n; i++){
			l[i] = in.nextInt();
			r[i] = in.nextInt();
		}
		
	}
	
	void add(int i, int v){
		int ix=i;
		while(ix<fenwick.length){
			fenwick[ix]+=v;
			ix=ix+(ix&-ix);
		}
	}
	
	int getSum(int i){
		int ix=i;
		int sum=0;
		while(ix>0){
			sum+=fenwick[ix];
			ix=ix-(ix&-ix);
		}
		return sum;
	}
	
	void solve2(){
		TreeSet<Integer> set = new TreeSet<Integer>();
		
		for(int i=0; i<n; i++){
			set.add(l[i]);
			set.add(r[i]);
		}
		
		int index = 0;
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		int map2[] = new int[2*set.size()+10];
		for(Integer x:set){
			map.put(x, 1+index*2);
			map2[1+index*2] = x;
			index++;
		}
		int m = set.size();
		set = null;		
		System.gc();
		
		fenwick = new int[2*m+10];
		for(int i=0; i<n; i++){
			add(map.get(l[i]),1);
			add(map.get(r[i])+1,-1);
		}
		
		map = null;
		System.gc();
		
		ArrayList<Integer> ul = new ArrayList<Integer>();
		ArrayList<Integer> ur = new ArrayList<Integer>();
		int nrsegm = 0;
		boolean started = false;		
		for(int i=1; i<=2*m; i++){
			//System.out.println(getSum(i));
			int counts = getSum(i);
			if (counts>=k){
				if (started == true){
					
				}
				else{
					started = true;
					ul.add(map2[i]);					
					nrsegm++;
				}
			}
			else{
				if (started == true)
					ur.add(map2[i-1]); 
				started = false;				
			}
		}
		System.out.println(nrsegm);		
		for(int i=0; i<nrsegm; i++)
			System.out.println(ul.get(i)+" "+ur.get(i));
		
		//
		
	}
	
	class Pair implements Comparable<Pair>{
		int i,v;

		public Pair(int j, int k) {
			i = j; v = k;
		}

		@Override
		public int compareTo(Pair arg0) {
			if (i==arg0.i)
				return -Integer.compare(v, arg0.v);
			return Integer.compare(i, arg0.i);
		}
		
	}
	public void solve(){
		ArrayList< Pair> L = new ArrayList<Pair>(2*n);
		
		for(int i=0; i<n; i++){
			L.add(new Pair(l[i],+1));
			L.add(new Pair(r[i],-1));
		}
		Collections.sort(L);
		
		
		int[][] lr = new int[2*n][2];
		int nr = 0;
		boolean started = false;
		int count = 0;
		for(int i=0; i<L.size(); i++){
			Pair p = L.get(i);
			count += p.v;
			
			if (count>=k){
				if (started == true){
				}
				else{
					started = true;
					lr[nr][0] = p.i;	
					nr++;
				}
			}
			else
			{
				if (started){
					lr[nr-1][1] = p.i;
				}
				started = false;
			}
			
		}
		
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(nr);
		for(int i=0; i<nr; i++)
			pw.println(lr[i][0]+" "+lr[i][1]);
		pw.close();
	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		D a = new D();
		a.readInput();
		a.solve();
	}

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;


    public InputReader(InputStream stream){
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String next(){
        while (tokenizer == null || !tokenizer.hasMoreTokens()){
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException("FATAL ERROR", e);
            }
        }

        return tokenizer.nextToken();
    }

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

}