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.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main
{

	/* IO */
	InputReader in;
	StringTokenizer tok;
	StringBuilder ans;

	/* FIELDS */
	int n, k;
	Point[] points;

	public static void main(String[] args) throws FileNotFoundException
	{
		Main sol = new Main();
		sol.begin();

	}

	private void begin() throws FileNotFoundException
	{
		// io
		boolean file = false;
		if (file)
			in = new InputReader(new FileInputStream("input.txt"));
		else
			in = new InputReader(System.in);
		ans = new StringBuilder();

		// read
		n = Integer.parseInt(in.next());
		k = Integer.parseInt(in.next());
		points = new Point[2 * n];
		for (int i = 0; i < n; i++)
		{
			int l = Integer.parseInt(in.next());
			int r = Integer.parseInt(in.next());
			points[i] = new Point(false, l);
			points[i + n] = new Point(true, r);
		}

		// solve
		solve();

	}

	private void solve()
	{
		// sort points by position
		Arrays.sort(points, new Comparator<Point>()
		{

			@Override
			public int compare(Point o1, Point o2)
			{
				if (o1.x != o2.x)
					return Integer.compare(o1.x, o2.x);
				else
					return Boolean.compare(o1.type, o2.type);
			}
		});

		// detect intersected segments and keep the max right
		int count = 0;
		int segL = Integer.MIN_VALUE;
		int segR = Integer.MIN_VALUE;
		int prevX = -1;
		int nL = 0;
		int nR = 0;
		for (int i = 0; i < 2 * n; i++)
		{
			// check if the segment is good,
			// then augment it to prev or make new one
			Point point = points[i];
			if (nL - nR >= k)
				if (prevX > segR)
				{
					// print the previous
					if (segL != Integer.MIN_VALUE)
					{
						count++;
						ans.append(segL + " " + segR + "\n");
					}

					// make the new segment
					segR = point.x;
					segL = prevX;
				}
				else
				{
					segR = point.x;
				}
			
			// update l, r, prev
			prevX = point.x;
			if (point.type == false)
				nL++;
			else
				nR++;
		}

		// print the last segment
		if (segL != Integer.MIN_VALUE)
		{
			count++;
			ans.append(segL + " " + segR + "\n");
		}			
		
		System.out.println(count);
		System.out.println(ans.toString());
	}
}

class Point
{
	boolean type;
	int x;

	public Point(boolean type, int x)
	{
		this.type = type;
		this.x = x;
	}
}

class InputReader
{
	BufferedReader reader;
	StringTokenizer tok;

	public InputReader(InputStream stream)
	{
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tok = new StringTokenizer("");
	}

	public String next()
	{
		while (!tok.hasMoreTokens())
			try
			{
				tok = new StringTokenizer(reader.readLine());
			} catch (IOException e)
			{
				e.printStackTrace();
			}
		return tok.nextToken();
	}
}