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
//package problem3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class Main {

	private static class Segment {
		int left, right;
		
		public Segment(int left, int right) {
			this.left = left;
			this.right = right;
		}
		
		@Override
		public String toString() {
			return left + " " + right;
		}
	}
	
	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] line = null;
		try {
			line = reader.readLine().split(" ");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// Read input.
		int n = Integer.parseInt(line[0]), k = Integer.parseInt(line[1]);
		List<Segment> segments1 = new ArrayList<Segment>();
		List<Segment> segments2 = new ArrayList<Segment>();
		for (int i = 0; i < n; ++i) {
			try {
				line = reader.readLine().split(" ");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			int x = Integer.parseInt(line[0]), y = Integer.parseInt(line[1]);
			segments1.add(new Segment(x, y));
			segments2.add(new Segment(x, y));
		}
		
		// Sort the segments1 according to their start position.
		segments1.sort(new Comparator<Segment>() {
			@Override
			public int compare(Segment o1, Segment o2) {
				if (o1.left < o2.left) {
					return -1;
				}
				if (o1.left > o2.left) {
					return 1;
				}
				return 0;
			}
		});
		// Sort the segments2 according to their start position.
				segments2.sort(new Comparator<Segment>() {
					@Override
					public int compare(Segment o1, Segment o2) {
						if (o1.right < o2.right) {
							return -1;
						}
						if (o1.right > o2.right) {
							return 1;
						}
						return 0;
					}
				});
		
		int active = 0;
		int p = 0, u = 0;
		int start = 0; boolean nowSegment = false;
		List<Segment> solution = new ArrayList<Segment>();
		while (p < segments1.size() || u < segments2.size()) {
			int next = segments2.get(u).right;
			if (p < segments1.size()) {
				next = Math.min(next, segments1.get(p).left);
			}
			
			while (p < segments1.size() && segments1.get(p).left <= next) {
				++active;
				++p;
			}
			
			if (active >= k) {
				if (!nowSegment) {
					nowSegment = true;
					start = next;
				}
			}
			
			while (u < segments2.size() && segments2.get(u).right <= next) {
				--active;
				++u;
			}
			
			if (nowSegment && active < k) {
				nowSegment = false;
				solution.add(new Segment(start, next));
			}
		}
		
		PrintWriter out = new PrintWriter(System.out);
		out.println(solution.size());
		for (Segment segment : solution) {
			out.println(segment);
		}
		out.close();
	}
}
