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
/*
Author - Ayub Subhaniya
Institute - DAI-ICT
*/
import java.io.*;
import java.math.*;
import java.util.*;

public class Codeforce392 {
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	static long mod=(int)1e9+7;
	
	public static void main(String[] args) {
		
		int n=in.nextInt();
		int k=in.nextInt();
		Pair events[]=new Pair[2*n];
		
		for (int i=0;i<n;i++)
		{
			events[i]=new Pair(in.nextInt(),0);
			events[i+n]=new Pair(in.nextInt(),1);
		}
		Arrays.sort(events);
	
		int active=0;
		TreeSet<Pair> point=new TreeSet<Pair>();
		int left=0;
		for  (int i=0;i<2*n;i++)
		{
			
			if (events[i].y==0)
			{
				active++;
				if (active==k)
					left=events[i].x;
			}
			else
			{
				active--;
				if (active==k-1)
					point.add(new Pair(left,events[i].x));
			}
		}
		
		out.println(point.size());
		Iterator<Pair> points=point.iterator();
		while (points.hasNext())
			out.println(points.next());
		
		out.close();
	}
}
class Pair implements Comparable<Pair> {
	int x;
	int y;

	Pair(int a, int b) {
		x = a;
		y = b;
	}

	@Override
	public boolean equals(Object o) {
		Pair other = (Pair) o;
		return x == other.x && y == other.y;
	}

	public String toString() {
		return x + " " + y;
	}

	@Override
	public int compareTo(Pair o) {
		if (x == o.x)
			return Integer.compare(y, o.y);
		else
			return Integer.compare(x, o.x);
	}

	@Override
	public int hashCode() {
		return Objects.hash(x, y);
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream inputstream) {
		reader = new BufferedReader(new InputStreamReader(inputstream));
		tokenizer = null;
	}

	public String nextLine() {
		String fullLine = null;
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				fullLine = reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return fullLine;
		}
		return fullLine;
	}

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

	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}
	
	public long[] nextLongArray(int n) {
		long a[] = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextLong();
		}
		return a;
	}

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

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void println(Object... objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}
}
