#include <bits/stdc++.h>
using namespace std;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
T ceil(T a, T b) {
  return (a + b - 1) / b;
}
template <typename T>
T binpow(T a, T b, T m) {
  a %= m;
  T res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
const long long MAX_N = 1e6 + 1;
const long long MOD = 998244353;
long long fact[MAX_N], invf[MAX_N];
void precompute() {
  fact[0] = invf[0] = 1;
  for (long long i = 1; i < MAX_N; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    invf[i] = binpow(fact[i], MOD - 2, MOD);
  }
}
long long nCr(long long n, long long k) {
  if (k < 0 || k > n) return 0;
  return fact[n] * invf[k] % MOD * invf[n - k] % MOD;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  if (k == 1) {
    cout << n << "\n";
    return;
  }
  precompute();
  vector<pair<long long, long long>> p;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    p.push_back({a, b});
  }
  sort((p).begin(), (p).end());
  multiset<long long> ms;
  long long res = 0;
  for (long long i = 0; i < n; i++) {
    if (!ms.empty()) {
      while (!ms.empty() and *ms.begin() < p[i].first) {
        auto it = ms.begin();
        ms.erase(it);
      }
      long long s = ms.size();
      (res += nCr(s, k - 1)) %= MOD;
    }
    ms.insert(p[i].second);
  }
  cout << res;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  for (long long i = 1; i < t + 1; i++) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
