#include <bits/stdc++.h>
const int MM = 998244353, B = 1 << 21;
using namespace std;
long long tree[B * 2];
long long fac[300005], res;
map<long long, long long> M;
long long inv(long long x) {
  long long y = MM - 2;
  long long res = 1;
  long long pot = x;
  while (y) {
    if (y & 1) res = res * pot % MM;
    pot = pot * pot % MM;
    y >>= 1;
  }
  return res;
}
long long ncr(long long a, long long b) {
  if (a < 0 || b < 0 || a - b < 0) return 0;
  return fac[a] * inv(fac[b] * fac[a - b] % MM) % MM;
}
pair<long long, long long> t[300005];
long long n, k;
int32_t main() {
  srand(chrono::steady_clock::now().time_since_epoch().count());
  cin >> n >> k;
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) {
    cin >> t[i].first >> t[i].second;
  }
  for (long long i = 1; i <= 2 * n; i++) {
    fac[i] = (fac[i - 1] * i) % MM;
  }
  long long X = 0;
  sort(t + 1, t + n + 1);
  set<pair<long long, long long> > s;
  for (long long i = 1; i <= n; i++) {
    while (!s.empty() && (*s.begin()).first < t[i].first) s.erase(s.begin());
    res += ncr(s.size(), k - 1);
    s.insert({t[i].second, i});
    if (res >= MM) res -= MM;
  }
  cout << res << "\n";
}
