#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int MAXN = 300005;
long long factorial[MAXN], inverse[MAXN];
long long power(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1LL;
  }
  return res;
}
long long nCk(int n, int k) {
  if (n == 0) return 0;
  if (k < 0 || k > n) {
    return 0;
  }
  long long ans = factorial[n];
  ans = (ans * inverse[n - k]) % mod;
  ans = (ans * inverse[k]) % mod;
  return ans;
}
void numberOfWays(vector<pair<int, int> > lines, int K, int N) {
  sort(lines.begin(), lines.end());
  long long total_case = 0;
  multiset<int> m;
  for (int i = 0; i < N; i++) {
    while (!m.empty() && (*m.begin() < lines[i].first)) {
      m.erase(m.begin());
    }
    total_case += nCk(m.size(), K - 1);
    total_case += mod;
    total_case %= mod;
    m.insert(lines[i].second);
  }
  cout << total_case << endl;
}
void preCompute() {
  long long fact = 1;
  factorial[0] = 1;
  inverse[0] = 1;
  for (int i = 1; i < MAXN; i++) {
    fact = (fact * i) % mod;
    factorial[i] = fact;
    inverse[i] = power(factorial[i], mod - 2);
  }
}
int main() {
  int n, k;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  vector<pair<int, int> > lines;
  preCompute();
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    lines.push_back({x, y});
  }
  if (k == 1) {
    cout << n;
    exit(0);
  }
  numberOfWays(lines, k, n);
  return 0;
}
