#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long MOD = 998244353;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const long long MAXN = 1e+5 + 7;
const int m = 998244353;
const int nax = 1e6;
long long fatorial[nax + 1];
long long binary_pow(long long a, long long b) {
  a = a % m;
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a) % m;
    }
    a = (a * a) % m;
    b = b >> 1;
  }
  return ans;
}
long long modular_inverse(long long a) { return binary_pow(a, m - 2); }
void calcula_fatorial() {
  fatorial[0] = 1;
  for (int i = 1; i <= nax; i++) {
    fatorial[i] = (fatorial[i - 1] * i) % m;
  }
}
long long binomial_coefficient(int n, int k) {
  return fatorial[n] * modular_inverse(fatorial[k]) % m *
         modular_inverse(fatorial[n - k]) % m;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  set<long long> evento;
  map<long long, long long> entrada, saida;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    evento.insert(a);
    evento.insert(b);
    entrada[a]++;
    saida[b]++;
  }
  long long ans = 0, sz = 0;
  for (auto e : evento) {
    sz += entrada[e];
    for (int i = 0; i < saida[e]; ++i) {
      if (sz - 1 < k - 1) {
        sz--;
        continue;
      }
      ans += binomial_coefficient(sz - 1, k - 1);
      ans %= m;
      sz--;
    }
  }
  cout << ans << '\n';
}
int main() {
  calcula_fatorial();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long i, j, n;
  int t = 1;
  while (t--) solve();
  return 0;
}
