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

public class Solution{
	
	
	
    public static void main(String[] args) throws IOException {
     
    	FastScanner fs = new FastScanner();
    	PrintWriter out = new PrintWriter(System.out);
    	
    		
    		
    	int tt = 1;
    	while(tt-->0) {
    		
    		int n = fs.nextInt();
    		int k = fs.nextInt();
    		
    		int[][] arr = new int[n][2];
    		int[] pos = new int[3*n];
    		
    		for(int i=0;i<n;i++	) {
    			arr[i][0] = fs.nextInt();
    			arr[i][1] = fs.nextInt();
    			pos[i] = 2*arr[i][0];
    			pos[i+n] = 2*arr[i][1]; 
    			pos[i+2*n] = 2*arr[i][1] + 1;
    		}
    		
    		ruffleSort(pos);
    		
    		int[] cnt = new int[3*n+1];
    		
    		for(int i=0;i<n;i++) {
    			int l = lowerbound(pos, 2*arr[i][0]);
    			int r = lowerbound(pos, 2*arr[i][1]);
    			cnt[l]++;
    			cnt[r+1]--;
    		}
    		
    		for(int i=1;i<=3*n;i++) cnt[i] += cnt[i-1];
    		
    		int w = 1;
    		
    		ArrayList<int[]> list = new ArrayList<int[]>();
    		
    		for(int i=0;i<3*n;i++) {
    			if(cnt[i]>=k) {
    				int j = i;
    				while(j<3*n && cnt[j]>=k) j++;
    				int x = (pos[i]%2==0)?pos[i]/2:(pos[i]-1)/2;
    				int y = (pos[j-1]%2==0)?pos[j-1]/2:(pos[j-1]-1)/2;
    				list.add(new int[] {x, y});
    				i = j-1;
    			}
    		}
    		
    		out.println(list.size());
    		for(int[] ar: list) out.println(ar[0]+" "+ar[1]);
    		
    		
    		
    		
    	}
    	
    		
    		
    		
    	out.close();
    		
    }
    
    
    
    
    
    static int lowerbound(int[] arr, int x) {
    	int l = 0;
    	int r = arr.length;
    	while(l<r) {
    		int mid = (l+r)/2;
    		if(arr[mid]>=x) r = mid;
    		else l = mid + 1;
    	}
    	return l;
    }
    
    
    
    
    
    static final Random random=new Random();
    	
    static void ruffleSort(int[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); int temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
   
  
    
    	
    	
    static class FastScanner{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
     
    	public String next(){
    		while(!st.hasMoreElements()){
    			try{
    				st = new StringTokenizer(br.readLine());
    			} catch(IOException e){
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}
    		
    	public String nextLine() throws IOException {
    		return br.readLine();
    	}
    		
    	public int nextInt(){
    		return Integer.parseInt(next());
    	}
     
    	public int[] readArray(int n){
    		int[] a = new int[n];
    		for(int i=0;i<n;i++)
    			a[i] = nextInt();
    		return a;
    	}
    		
    	public long nextLong() {
    		return Long.parseLong(next());
    	}
    		
    	public char nextChar() {
    		return next().toCharArray()[0];
    	}
    }
   	
}