#include <bits/stdc++.h>   using namespace std;   long long spf[3000001];   long long fac[3000001];   void sieve() {     spf[1] = 1;     for (long long i = 2; i < 3000001; i++) spf[i] = i;     for (long long i = 4; i < 3000001; i += 2) spf[i] = 2;     for (long long i = 3; i * i < 3000001; i++) {       if (spf[i] == i) {         for (long long j = i * i; j < 3000001; j += i)           if (spf[j] == j) spf[j] = i;       }     }   }   map<long long, long long> getfactor(long long a) {     map<long long, long long> m;     while (a > 1) {       m[spf[a]]++;       a /= spf[a];     }     return m;   }   long long power(long long x, long long y, long long p) {     long long res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   long long gcd(long long a, long long b) {     if (a == 0) return b;     return gcd(b % a, a);   }   long long inverse(long long a, long long p) { return power(a, p - 2, p); }   long long ncr(long long n, long long r, long long p) {     if (r > n) return 0;     if (r == 0) return 1;     return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;   }   void solve() {     long long n, k;     cin >> n >> k;     map<long long, long long> m;     for (long long i = 1; i <= n; i++) {       long long l, r;       cin >> l >> r;       m[l]++;       m[r + 1]--;     }     long long pre = 0;     for (auto it : m) {       pre += m[it.first];       m[it.first] = pre;     }     long long prev = -1e18, val = 0;     long long ans = 0;     for (auto it : m) {       if (prev == -1e18) {         prev = it.first;         val = it.second;       } else {         ans = (ans +                (ncr(val, k, 1000000007) * (it.first - prev) % 1000000007) %                    1000000007 +                1000000007) %               1000000007;         prev = it.first;         val = it.second;       }     }     cout << ans <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long test = 1;     fac[0] = 1;     for (long long i = 1; i <= 300000; i++)       fac[i] = (fac[i - 1] * i) % 1000000007;     while (test--) {       solve();     }   }   