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.
The first line contains two integers *n* and *k* (1 ≤ *k* ≤ *n* ≤ 10<sup class="upper-index">6</sup>) — the number of segments and the value of *k*.

The next *n* lines contain two integers *l*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub> ( - 10<sup class="upper-index">9</sup> ≤ *l*<sub class="lower-index">*i*</sub> ≤ *r*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) each — the endpoints of the *i*-th segment. The segments can degenerate and intersect each other. The segments are given in arbitrary order.
none
3 2
0 5
-3 2
3 8
2
0 2
3 5
3 2
0 5
-3 3
3 8
1
0 5
1 1
-1 1
1
-1 1
10 2
27 96
-22 45
-68 26
46 69
-91 86
12 73
-89 76
-11 33
17 47
-57 78
1
-89 86
10 1
3 60
-73 -37
59 69
-56 1
-84 -24
-14 46
-65 -23
-66 -57
-87 -80
-21 20
1
-87 69
10 10
-92 87
-100 -67
-88 80
-82 -59
-72 81
-50 30
30 77
65 92
-76 -60
-29 -15
0
1 1
-941727901 756748222
1
-941727901 756748222
1 1
-990637865 387517231
1
-990637865 387517231
1 1
-870080964 571991746
1
-870080964 571991746
10 8
-749560329 759073394
-186423470 816422576
-674251064 742056817
-342947007 954589677
-306243234 999298121
-448636479 409818446
-885248428 624359061
-936960294 754851875
-781500924 984124751
-342740564 618223559
1
-342740564 624359061
10 1
-260424665 -168566709
299109864 663179811
769984405 942516913
-998905510 -707148023
-167958021 60599275
658861231 718845364
79407402 279078536
13652788 79756488
-676213666 -339118351
-349156760 -258185154
5
-998905510 -707148023
-676213666 -168566709
-167958021 279078536
299109864 718845364
769984405 942516913
10 8
-278661264 757623461
-751226975 996393413
-721476675 863607399
-228431002 643113689
-209293138 701503607
-433870703 932866969
-385182911 667745533
-661057075 783312740
-617789923 657076219
-890369225 990071765
1
-278661264 667745533
4 2
2 2
2 2
2 3
3 3
2
2 2
3 3
2 2
-3 1
-4 -1
1
-3 -1
1 1
2 2
1
2 2
2 1
0 2
-1 0
1
-1 2
2 2
-1000000000 1000000000
-1000000000 100
1
-1000000000 100
# for I/O for local system
import sys
from os import path
if(path.exists('Input.txt')):
    sys.stdin = open("Input.txt","r")
    sys.stdout = open("Output.txt","w")

# For fast I/O
input = sys.stdin.buffer.readline
# input = sys.stdin.readline
print = sys.stdout.write

# Import libraries here whenever required
from random import randint

# Use this because normal dict can sometimes give TLE
class mydict:
    def __init__(self, func=lambda: 0):
        self.random = randint(0, 1 << 32)
        self.default = func
        self.dict = {}
    def __getitem__(self, key):
        mykey = self.random ^ key
        if mykey not in self.dict:
            self.dict[mykey] = self.default()
        return self.dict[mykey]
    def get(self, key, default):
        mykey = self.random ^ key
        if mykey not in self.dict:
            return default
        return self.dict[mykey]
    def __setitem__(self, key, item):
        mykey = self.random ^ key
        self.dict[mykey] = item
    def getkeys(self):
        return [self.random ^ i for i in self.dict]
    def __str__(self):
        return f'{[(self.random ^ i, self.dict[i]) for i in self.dict]}'
    
from math import inf, log2


class LazySegmentTree:
    def __init__(self, array, func=max):
        self.n = len(array)
        self.size = 2**(int(log2(self.n-1))+1) if self.n != 1 else 1
        self.func = func
        self.default = 0 if self.func != min else inf
        self.data = [self.default] * (2 * self.size)
        self.lazy = [0] * (2 * self.size)
        self.process(array)

    def process(self, array):
        self.data[self.size : self.size+self.n] = array
        for i in range(self.size-1, -1, -1):
            self.data[i] = self.func(self.data[2*i], self.data[2*i+1])

    def push(self, index):
        """Push the information of the root to it's children!"""
        self.lazy[2*index] += self.lazy[index]
        self.lazy[2*index+1] += self.lazy[index]
        self.data[2 * index] += self.lazy[index]
        self.data[2 * index + 1] += self.lazy[index]
        self.lazy[index] = 0

    def build(self, index):
        """Build data with the new changes!"""
        index >>= 1
        while index:
            self.data[index] = self.func(self.data[2*index], self.data[2*index+1]) + self.lazy[index]
            index >>= 1

    def query(self, alpha, omega):
        """Returns the result of function over the range (inclusive)!"""
        res = self.default
        alpha += self.size
        omega += self.size + 1
        for i in range(len(bin(alpha)[2:])-1, 0, -1):
            self.push(alpha >> i)
        for i in range(len(bin(omega-1)[2:])-1, 0, -1):
            self.push((omega-1) >> i)
        while alpha < omega:
            if alpha & 1:
                res = self.func(res, self.data[alpha])
                alpha += 1
            if omega & 1:
                omega -= 1
                res = self.func(res, self.data[omega])
            alpha >>= 1
            omega >>= 1
        return res

    def update(self, alpha, omega, value):
        """Increases all elements in the range (inclusive) by given value!"""
        alpha += self.size
        omega += self.size + 1
        l, r = alpha, omega
        while alpha < omega:
            if alpha & 1:
                self.data[alpha] += value
                self.lazy[alpha] += value
                alpha += 1
            if omega & 1:
                omega -= 1
                self.data[omega] += value
                self.lazy[omega] += value
            alpha >>= 1
            omega >>= 1
        self.build(l)
        self.build(r-1)    
    
# Solver function
def solve():
    n, k = map(int, input().split())
    helper = [0 for i in range(2 * 10 ** 9 + 10)]
    s = LazySegmentTree(helper, lambda a, b: a + b)
    mn = 10 ** 18
    mx = -10 ** 18
    for i in range(n):
        l, r = map(int, input().split())
        l += 10 ** 9
        r += 10 ** 9
        mn = min(mn, l, r)
        mx = max(mx, l, r)
        s.update(l, r, 1)
    ans = []
    i = mn
    helper = []
    while i <= mx:
        if(s.query(i) >= k):
            helper.append(i)
            while i <= mx and s.query(i) >= k:
                i += 1
            i -= 1
            helper.append(i)
            ans.append(helper.copy())
            helper = []
        else:
            i += 1
    print(str(len(ans)) + "\n")
    for i, j in ans:
        print(str(i) + " " + str(j) + "\n")
            
# Main 
for _ in range(1):
    solve()