#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int pwr(int x, int n) {
  if (!n) return 1;
  if (n % 2) return 1LL * x * pwr(1LL * x * x % MOD, n / 2) % MOD;
  return pwr(1LL * x * x % MOD, n / 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> ev;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    ev.emplace_back(x, -i);
    ev.emplace_back(y, +i);
  }
  sort(ev.begin(), ev.end());
  vector<int> fact(n + 1);
  fact[0] = 1;
  for (int i = 1; i <= n; i++) fact[i] = 1LL * fact[i - 1] * i % MOD;
  vector<int> mInv(n + 1);
  mInv[n] = pwr(fact[n], MOD - 2);
  for (int i = n - 1; i >= 0; i--) mInv[i] = 1LL * mInv[i + 1] * (i + 1) % MOD;
  auto comb = [&](int n, int k) {
    if (k > n) return 0LL;
    return 1LL * fact[n] * mInv[k] % MOD * mInv[n - k] % MOD;
  };
  int ans = 0, cnt = 0;
  for (auto e : ev) {
    if (e.second < 0) {
      cnt++;
      ans = (ans + comb(cnt - 1, k - 1)) % MOD;
    } else
      cnt--;
  }
  cout << ans << '\n';
  return 0;
}
