#include <bits/stdc++.h>
using namespace std;
inline long long getint() {
  char c = getchar();
  long long ret = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
  return ret * f;
}
const int maxn = 3e5 + 10;
const int crz = 998244353;
priority_queue<int, vector<int>, greater<int> > Q;
pair<int, int> p[maxn];
int n, m, N, T;
int fac[maxn], ifac[maxn];
inline int C(int n, int m) {
  if (n < 0 || m > n) return 0;
  return 1ll * fac[n] * ifac[m] % crz * ifac[n - m] % crz;
}
inline int mod(int x) { return x >= crz ? x - crz : x; }
inline void solve() {
  T = N = 0;
  n = getint();
  m = getint();
  for (int i = 1; i <= n; i++) {
    int l = getint(), r = getint();
    p[i] = make_pair(l, r);
  }
  sort(p + 1, p + n + 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    while (!Q.empty() && Q.top() < p[i].first) Q.pop();
    ans = mod(ans + C(Q.size(), m - 1));
    Q.push(p[i].second);
  }
  printf("%d\n", ans);
}
inline int qpow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % crz;
    a = 1ll * a * a % crz;
    b >>= 1;
  }
  return ret;
}
inline void init() {
  n = 300000;
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % crz;
  ifac[n] = qpow(fac[n], crz - 2);
  for (int i = n - 1; i >= 0; i--) ifac[i] = 1ll * ifac[i + 1] * (i + 1) % crz;
}
int main() {
  init();
  solve();
  return 0;
}
