#include <bits/stdc++.h>
using namespace std;
const long long int mod = 998244353;
const int maxn = 1e5 + 10;
void pvec(vector<int> v) {
  for (auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}
long long int gcd(long long int x, long long int y) {
  if (y == 0) {
    return x;
  } else {
    return gcd(y, x % y);
  }
}
long long int binpow(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  }
  long long int res = 1;
  long long int tmp = binpow(a, b / 2);
  res = (tmp * tmp) % mod;
  if (b % 2 == 1) {
    res = (res * a) % mod;
  }
  return res;
}
struct node {
  int pos;
  int l;
  int r;
  int val;
};
bool comp(node a, node b) {
  if (a.val == b.val) return a.l > b.l;
  return a.val > b.val;
}
void update(int* BIT, int n, int idx) {
  while (idx <= n) {
    BIT[idx]++;
    idx += idx & (-idx);
  }
}
int query(int* BIT, int idx) {
  int ans = 0;
  while (idx) {
    ans += BIT[idx];
    idx -= idx & (-idx);
  }
  return ans;
}
vector<int> solveQuery(int arr[], int n, int QueryL[], int QueryR[],
                       int QueryK[], int q) {
  node a[n + q + 1];
  for (int i = 1; i <= n; ++i) {
    a[i].val = arr[i - 1];
    a[i].pos = 0;
    a[i].l = 0;
    a[i].r = i;
  }
  for (int i = n + 1; i <= n + q; ++i) {
    a[i].pos = i - n;
    a[i].val = QueryK[i - n - 1];
    a[i].l = QueryL[i - n - 1];
    a[i].r = QueryR[i - n - 1];
  }
  sort(a + 1, a + n + q + 1, comp);
  int BIT[n + 1];
  memset(BIT, 0, sizeof(BIT));
  int ans[q + 1];
  for (int i = 1; i <= n + q; ++i) {
    if (a[i].pos != 0) {
      int cnt = query(BIT, a[i].r) - query(BIT, a[i].l - 1);
      ans[a[i].pos] = cnt;
    } else {
      update(BIT, n, a[i].r);
    }
  }
  vector<int> ai;
  for (int i = 1; i <= q; ++i) {
    ai.push_back(ans[i]);
  }
  return ai;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<long long int> nck(n + 1, 0);
  long long int kf = 1, kfi;
  for (long long int i = 1; i <= k - 1; i++) {
    kf = (kf * i) % mod;
  }
  kfi = binpow(kf, mod - 2);
  nck[k - 1] = 1;
  for (int i = k; i <= n; i++) {
    nck[i] = (nck[i - 1] * i) % mod;
    nck[i] = (nck[i] * binpow(i - k + 1, mod - 2)) % mod;
  }
  vector<pair<int, int> > v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.begin(), v.end());
  int r[n];
  for (int i = 0; i < n; i++) {
    r[i] = v[i].second;
  }
  int q = n - k + 1;
  int ql[q], qr[q], qk[q];
  for (int i = k - 1; i < n; i++) {
    ql[i - k + 1] = 1;
    qr[i - k + 1] = i;
    qk[i - k + 1] = v[i].first - 1;
  }
  vector<int> ai = solveQuery(r, n, ql, qr, qk, q);
  long long int ans = 0;
  for (int u : ai) {
    ans = (ans + nck[u]) % mod;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  int cnt = 1;
  while (t--) {
    solve();
  }
  return 0;
}
