#include <bits/stdc++.h>
using namespace std;
long long nax = 3 * 1e5 + 5;
vector<long long int> fac(nax + 1, 0), inv(nax + 1, 0);
long long binpow(long long a, long long b) {
  a %= 998244353;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % 998244353;
    a = a * a % 998244353;
    b >>= 1;
  }
  return res;
}
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  return ((fac[n] * inv[r] % 998244353) * inv[n - r]) % 998244353;
}
bool mc(pair<long long int, long long int> p1,
        pair<long long int, long long int> p2) {
  if (p1.first == p2.first) return p1.second > p2.second;
  return p1.first < p2.first;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<pair<long long int, long long int> > a;
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    a.push_back({l, 1});
    a.push_back({r + 1, 2});
  }
  sort(a.begin(), a.end(), mc);
  long long cnt = 0, ans = 0;
  for (auto it : a) {
    if (it.second == 1) {
      ans = (ans + ncr(cnt, k - 1)) % 998244353;
      cnt++;
    } else
      cnt--;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  fac[0] = 1;
  for (long long i = 1; i <= nax; i++) fac[i] = (fac[i - 1] * i) % 998244353;
  inv[nax] = binpow(fac[nax], 998244353 - 2);
  for (long long i = nax - 1; i >= 0; i--)
    inv[i] = (inv[i + 1] * (i + 1)) % 998244353;
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  cin.get();
  return 0;
}
