Hongjun's Intersection

Sum the lengths of the intersections of all k-subsets of given segments, modulo 1e9+7.

Hard8SortingCombinatoricsPrefix sumNo attempts yetTime limit2sMemory limit512 MB

Problem

There are NN one dimensional segments on a horizontal line. Call the ii-th segment [Li,Ri][L_i, R_i] (LiRiL_i \le R_i). The length of a segment is f([Li,Ri])=RiLi+1f([L_i, R_i]) = R_i - L_i + 1, and the length of the empty set is f()=0f(\varnothing) = 0.

You are given a positive integer kk with kNk \le N. For every way of choosing kk distinct segments, add up the length of the intersection of the chosen segments:

1i1<i2<<ikNf([Li1,Ri1][Li2,Ri2][Lik,Rik])\sum_{1 \le i_1 < i_2 < \cdots < i_k \le N} f\bigl([L_{i_1}, R_{i_1}] \cap [L_{i_2}, R_{i_2}] \cap \cdots \cap [L_{i_k}, R_{i_k}]\bigr)

Write a program that computes this sum.

The answer can be very large, so print it modulo 109+710^9 + 7.

Input

The first line contains NN and kk. (1kN200,0001 \le k \le N \le 200{,}000)

Each of the next NN lines contains two integers LiL_i and RiR_i describing the ii-th segment. (109LiRi109-10^9 \le L_i \le R_i \le 10^9)

Output

Print on one line the sum of the intersection lengths over every way of choosing kk distinct segments, modulo 109+710^9 + 7.

Hint

When the segments are [1,2][1, 2], [1,3][1, 3], [2,3][2, 3] and k=2k = 2, there are three ways to choose, and the intersection lengths are:

f([1,2][1,3])=f([1,2])=2f([1,2] \cap [1,3]) = f([1,2]) = 2

f([1,2][2,3])=f([2,2])=1f([1,2] \cap [2,3]) = f([2,2]) = 1

f([1,3][2,3])=f([2,3])=2f([1,3] \cap [2,3]) = f([2,3]) = 2

So the answer is 2+1+2=52 + 1 + 2 = 5.