#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
vector<long long int> fact(1e6);
void PreCompute() {
  fact[0] = 1;
  for (long long int i = 1; i < 1e6; i++) {
    fact[i] = ((fact[i - 1] % mod) * i) % mod;
  }
}
long long int modexp(long long int x, long long int n, long long int m) {
  if (n == 0)
    return 1ll;
  else if (n & 1ll) {
    return (x * modexp(x, n - 1, m)) % m;
  } else {
    long long int y = modexp(x, n / 2, m);
    return (y * y) % m;
  }
}
long long int flt(long long int a, long long int p) {
  return modexp(a, p - 2, p);
}
long long int nchooser(long long int n, long long int r) {
  if (r > n)
    return 0;
  else if (r == n)
    return 1;
  else {
    long long int num = fact[n];
    long long int denom = ((fact[r] * fact[n - r])) % mod;
    long long int invdenom = flt(denom, mod);
    return (num * invdenom) % mod;
  }
}
void Compute(long long int n, long long int k) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<pair<long long int, long long int> > events(n);
  vector<pair<long long int, long long int> > vec;
  for (long long int i = 0; i < n; i++) {
    cin >> events[i].first >> events[i].second;
    vec.emplace_back(make_pair(events[i].first, 0ll));
    vec.emplace_back(make_pair(events[i].second, 1ll));
  }
  sort(vec.begin(), vec.end());
  long long int cnt = 0;
  long long int active_events = 1;
  if (k == 1) cnt++;
  for (long long int i = 1; i < vec.size(); i++) {
    if (vec[i].second == 0) {
      cnt += nchooser(active_events, k - 1);
      cnt %= mod;
      active_events++;
    } else if (vec[i].second == 1) {
      active_events--;
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  PreCompute();
  long long int n, k;
  cin >> n >> k;
  Compute(n, k);
}
