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
class SegmentTreeDual():
    def __init__(self, arr, op=lambda x, y: y if y != -1 else x, ie=-1):
        self.h = (len(arr) - 1).bit_length()
        self.n = 2**self.h
        self.ie = ie
        self.op = op
        self.val = [ie for _ in range(self.n)]
        self.laz = [ie for _ in range(2 * self.n)]
        for i in range(len(arr)):
            self.val[i] = arr[i]

    def propagate(self, k):
        if self.laz[k] == self.ie: return
        if self.n <= k:
            self.val[k - self.n] = self.op(self.val[k - self.n], self.laz[k])
            self.laz[k] = self.ie
        else:
            self.laz[2 * k] = self.op(self.laz[2 * k], self.laz[k])
            self.laz[2 * k + 1] = self.op(self.laz[2 * k + 1], self.laz[k])
            self.laz[k] = self.ie

    def update(self, left, right, x):
        left += self.n
        right += self.n
        while right - left > 0:
            if right & 1:
                right -= 1
                self.laz[right] = self.op(self.laz[right], x)
            if left & 1:
                self.laz[left] = self.op(self.laz[left], x)
                left += 1
            left >>= 1
            right >>= 1

    def get(self, index):
        res = self.val[index]
        index += self.n
        while index > 0:
            res = self.op(res, self.laz[index])
            index //= 2
        return res

import sys
input = sys.stdin.readline

from operator import add

INF = 10**18

N, K = map(int, input().split())

I = []
V = []

for _ in range(N):
    l, r = map(int, input().split())
    V.append(l)
    V.append(r)
    I.append((l, r))

V = sorted(set(V))

comp = {v : k for k, v in enumerate(V)}
arr = [0 for _ in range(len(V) + 1)]

st = SegmentTreeDual(arr, add, 0)

for i in range(N):
    l, r = I[i]
    st.update(comp[l], comp[r], 1)

A = []

for i in range(len(V) + 1):
    if st.get(i) >= K:
        A.append(i)

A.append(INF)

res = []

l = A[0]
r = A[0]
for i in range(len(A) - 1):
    if A[i] + 1 == A[i + 1]:
        r = A[i + 1]
    else:
        res.append((V[l], V[r + 1]))
        l = A[i + 1]
        r = A[i + 1]

print(len(res))
for l, r in res:
    print(l, r)