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.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D
{
	public static void main(String[] args) throws Throwable
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Event[] arr = new Event[n<<1];
		int k = sc.nextInt();
		for(int i=0;i<n;i++)
		{
			arr[i * 2] = new Event(0, sc.nextInt());
			arr[i * 2 + 1] = new Event(1, sc.nextInt());
		}

		int last = Integer.MIN_VALUE;
		int cnt = 0;
		ArrayList<Integer> x = new ArrayList<>();
		ArrayList<Integer> y = new ArrayList<>();
		Arrays.sort(arr);
		for (int i = 0; i < arr.length; i++)
		{
			int type = arr[i].type;
			int idx = arr[i].idx;
			if(type == 0){
				cnt++;
				if(last == Integer.MIN_VALUE && cnt == k)
				{
					last = idx;
				}
			}
			else{
				cnt--;
				if(cnt == k - 1)
				{
					x.add(last);
					y.add(idx);
					last = Integer.MIN_VALUE;
				}
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(x.size());
		for(int i=0;i<x.size();i++)
			pw.println(x.get(i) + " " + y.get(i));
		pw.flush();
	}

	static class Event implements Comparable<Event>
	{
		int type, idx;		//0 --> start, 1 --> end
		public Event(int a, int b){
			type = a;
			idx = b;
		}
		@Override
		public int compareTo(Event e)
		{
			if(idx != e.idx)
				return idx - e.idx;
			return type - e.type;
		}
	}

	static class Scanner{
		StringTokenizer st;BufferedReader br;
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String s) throws FileNotFoundException{	br = new BufferedReader(new FileReader(new File(s)));}
		public String next() throws IOException 
		{while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());return st.nextToken();}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public long nextLong() throws IOException {return Long.parseLong(next());}
		public String nextLine() throws IOException {return br.readLine();}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public boolean ready() throws IOException {return br.ready();}
	}
}
