#include <bits/stdc++.h>
using namespace std;
long long mul_inv(long long a, long long b) {
  long long b0 = b, t, q;
  long long x0 = 0, x1 = 1;
  if (b == 1) return 1;
  while (a > 1) {
    q = a / b;
    t = b, b = a % b, a = t;
    t = x0, x0 = x1 - q * x0, x1 = t;
  }
  if (x1 < 0) x1 += b0;
  return x1;
}
long long fact[2000001];
long long ifact[2000001];
long long nCr(long long n, long long r) {
  return (((fact[n] * ifact[n - r]) % 1000000007) * ifact[r]) % 1000000007;
}
int main(int argc, char const *argv[]) {
  fact[0] = 1;
  for (int i = 1; i <= 2000000; i++) {
    fact[i] = (i * fact[i - 1]) % 1000000007;
  }
  ifact[2000000] = mul_inv(fact[2000000], 1000000007);
  for (int i = 2000000 - 1; i >= 0; i--) {
    ifact[i] = ((i + 1) * ifact[i + 1]) % 1000000007;
  }
  int n, k;
  scanf("%d%d", &n, &k);
  pair<int, int> a[2 * n];
  for (int i = 0; i < 2 * n; i++) {
    int x;
    scanf("%d", &x);
    if (i & 1) {
      a[i] = pair<int, int>(x, 1);
    } else
      a[i] = pair<int, int>(x, -1);
  }
  sort(a, a + 2 * n);
  int dp[n + 1];
  memset(dp, 0, sizeof(dp));
  int cnt = 0;
  for (int i = 0; i < 2 * n;) {
    int j = i;
    while (j < 2 * n && a[j].first == a[i].first && a[j].second == -1) {
      j++;
      cnt++;
    }
    dp[cnt]++;
    while (j < 2 * n && a[j].first == a[i].first && a[j].second == 1) {
      j++;
      cnt--;
    }
    if (j < 2 * n) {
      dp[cnt] += a[j].first - a[i].first - 1;
    }
    i = j;
  }
  long long ans = 0;
  for (int i = k; i <= n; i++) {
    ans = (ans + nCr(i, k) * dp[i]) % 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
