#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 998244353;
long long int modexp(long long int a, long long int b) {
  long long int ret = 1;
  while (b > 0) {
    if (b & 1) {
      ret = (ret * a) % MOD;
    }
    a = (a * a) % MOD;
    b >>= 1;
  }
  return ret;
}
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<pair<long long int, long long int> > lamps;
  for (int i = 0; i < n; i++) {
    long long int l, r;
    cin >> l >> r;
    lamps.push_back({l, r});
  }
  vector<long long int> comb(n + 5, 0);
  long long int _k = k - 1;
  comb[_k] = 1;
  for (long long int i = _k + 1; i <= n; i++) {
    comb[i] = ((comb[i - 1] * i) % MOD * modexp(i - _k, MOD - 2)) % MOD;
  }
  sort(lamps.begin(), lamps.end());
  auto cmp = [](pair<long long int, long long int> a,
                pair<long long int, long long int> b) {
    return a.second > b.second;
  };
  long long int ans = 0;
  priority_queue<pair<long long int, long long int>,
                 vector<pair<long long int, long long int> >, decltype(cmp)>
      pq(cmp);
  for (int i = 0; i < n; i++) {
    while (!pq.empty() && pq.top().second < lamps[i].first) {
      pq.pop();
    }
    ans = (ans + comb[pq.size()]) % MOD;
    pq.push(lamps[i]);
  }
  cout << ans << endl;
  return 0;
}
