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.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class CFPROBD {
	public static void main(String[] args) {
		Scanner2 input = new Scanner2();
		int segments = input.nextInt();
		int jury = input.nextInt();
		ArrayList<Integer> pointsOfInterest = new ArrayList<Integer>(2*segments+10);
		ArrayList<Interval> intervals = new ArrayList<Interval>(segments+10);
		ArrayList<Interval> intervalsRight = new ArrayList<Interval>(segments+10);
		//segments = 1000000;
		
		for(int a = 0; a < segments; a++){
			int left = input.nextInt();
			int right = input.nextInt();
			//int left = ((int)(Math.random() * Integer.MAX_VALUE))-Integer.MAX_VALUE/2;
			//int right = left + ((int)(Math.random() * Integer.MAX_VALUE))/ 3;
			intervals.add(new Interval(left, right));
			intervalsRight.add(new Interval(left, right));
			
		}
		//System.out.println(intervals);// + " " + intervalsRight);
		Collections.sort(intervals, new Comparator<Interval>() {
			public int compare(Interval o1, Interval o2) {
			    return Integer.compare(o1.start, o2.start);
			}
			});
		Collections.sort(intervalsRight, new Comparator<Interval>() {
			public int compare(Interval o1, Interval o2) {
			    return Integer.compare(o1.end, o2.end);
			}
			});
		int index1 = 0;
		int index2 = 0;
		while(index1 < intervals.size() && index2 < intervalsRight.size()){
			if(intervals.get(index1).start > intervalsRight.get(index2).end){
				pointsOfInterest.add(intervalsRight.get(index2).end);
				index2++;
			}
			else{
				pointsOfInterest.add(intervals.get(index1).start);
				index1++;
			}
		}
		while(index2 < intervalsRight.size()){
			pointsOfInterest.add(intervalsRight.get(index2).end);
			index2++;
		}
		//System.out.println(pointsOfInterest.size());
		int thickness = 0;
		int startIndex = -1;
		int endIndex = -1;
		int intervalStart = Integer.MIN_VALUE;
		int segmentsCount = 0;
		//StringBuilder output = new StringBuilder();
		ArrayList<Interval> output = new ArrayList<Interval>();
		int previous = Integer.MIN_VALUE;
		int flagged = Integer.MIN_VALUE;
		for(Integer a: pointsOfInterest){
	   		int thickBefore = thickness;
			while(startIndex+1 < intervals.size() && intervals.get(startIndex+1).start == a){
				thickness++;
				startIndex++;
			}
			int thickMiddle = thickness;
			while(endIndex+1 < intervals.size() && intervalsRight.get(endIndex+1).end == a){
				thickness--;
				endIndex++;
			}
			if(thickMiddle >= jury && thickness < jury && thickBefore < jury && flagged != a){
			     output.add(new Interval(a, a));
				 flagged = a;
				 segmentsCount++;
			}

 		//System.out.println("thickness is " + thickness);
			if(thickness >= jury && intervalStart == Integer.MIN_VALUE){
				intervalStart = a;
			}
			if(thickness < jury && intervalStart != Integer.MIN_VALUE){
				segmentsCount++;
				output.add(new Interval(intervalStart, a));
				intervalStart = Integer.MIN_VALUE;
			}
		}	
		if(intervalStart != Integer.MIN_VALUE){
			segmentsCount++;
			output.add(new Interval(intervalStart, pointsOfInterest.get(pointsOfInterest.size()-1)));
			intervalStart = Integer.MIN_VALUE;
		}
		System.out.println(segmentsCount);
		StringBuilder outputBuffer = new StringBuilder();
		for(Interval q: output){
			outputBuffer.append(q.start);
			outputBuffer.append(" ");
			outputBuffer.append(q.end);
			outputBuffer.append("\n");
		}
		System.out.print(outputBuffer);
	}
	public static class Interval{
		int start;
		int end;
		public Interval(int left, int right){
			start = left;
			end = right;
		}
		public String toString(){
			return start + " " + end;
		}
	}
	public static class Scanner2 {
		BufferedReader br;
		StringTokenizer st;

		public Scanner2(Reader in) {
			br = new BufferedReader(in);
		}

		public Scanner2() {
			this(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		// Slightly different from java.util.Scanner.nextLine(),
		// which returns any remaining characters in current line,
		// if any.
		String readNextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}