#include <bits/stdc++.h>
using namespace std;
int tree[2][400232];
int read(int id, int idx) {
  int sum = 0;
  while (idx > 0) {
    sum += tree[id][idx];
    idx -= (idx & -idx);
  }
  return sum;
}
void update(int id, int idx, int val) {
  while (idx <= 400232) {
    tree[id][idx] += val;
    idx += (idx & -idx);
  }
}
long long int mod_pow(long long int x, long long int y) {
  long long int r = 1;
  while (y > 0) {
    if (y % 2 == 1) {
      r = (r * x) % ((long long int)1e9 + 7);
    }
    x = (x * x) % ((long long int)1e9 + 7);
    y /= 2;
  }
  return r % ((long long int)1e9 + 7);
}
long long int perm[400232];
long long int invPerm[400232];
bool comp(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }
long long int comb(int n, int k) {
  return (((perm[n] * invPerm[k]) % ((long long int)1e9 + 7)) *
          invPerm[n - k]) %
         ((long long int)1e9 + 7);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> arr(n);
  perm[0] = 1;
  invPerm[0] = 1;
  for (int i = 1; i < 400232 / 2; i++) {
    perm[i] = (perm[i - 1] * i) % ((long long int)1e9 + 7);
    invPerm[i] = mod_pow(perm[i], ((long long int)1e9 + 7) - 2) %
                 ((long long int)1e9 + 7);
  }
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr.begin(), arr.end());
  long long int L = 0, R = 0;
  int cl = 0, cr = 0;
  priority_queue<int> pq;
  for (int i = 0; i < n; i++) {
    int l = arr[i].first;
    int r = arr[i].second;
    while (!pq.empty() && -pq.top() < l) pq.pop();
    pq.push(-r);
    int a1 = pq.size();
    int toChoose = a1;
    if (toChoose >= k)
      L = (((long long int)1e9 + 7) + L +
           ((l - 1) * (comb(toChoose - 1, k - 1))) % ((long long int)1e9 + 7)) %
          ((long long int)1e9 + 7);
  }
  pq = priority_queue<int>();
  sort(arr.begin(), arr.end(), comp);
  for (int i = 0; i < n; i++) {
    int l = arr[i].first;
    int r = arr[i].second;
    while (!pq.empty() && pq.top() > r) pq.pop();
    pq.push(l);
    int a1 = pq.size();
    ;
    int toChoose = a1;
    if (toChoose >= k)
      R = (R + ((long long int)1e9 + 7) +
           ((r) * (comb(toChoose - 1, k - 1))) % ((long long int)1e9 + 7)) %
          ((long long int)1e9 + 7);
  }
  cout << (R - L + ((long long int)1e9 + 7)) % ((long long int)1e9 + 7);
  return 0;
}
