#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 998244353;
struct M {
  unsigned v;
  M(long long a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
  M& operator+=(M r) {
    if ((v += r.v) >= mod) v -= mod;
    return *this;
  }
  M& operator-=(M r) {
    if ((v += mod - r.v) >= mod) v -= mod;
    return *this;
  }
  M& operator*=(M r) {
    v = (uint64_t)v * r.v % mod;
    return *this;
  }
};
uint32_t add(M a, M b) { return (a += b).v; }
uint32_t mul(M a, M b) { return (a *= b).v; }
uint32_t sub(M a, M b) { return (a -= b).v; }
constexpr long long mm = 3e5 + 3;
long long fact[mm], invFact[mm];
void pre() {
  fact[0] = invFact[0] = invFact[1] = 1;
  for (long long i = 1; i < mm; i++) {
    fact[i] = mul(fact[i - 1], i);
  }
  for (long long i = 2; i < mm; i++) {
    invFact[i] = mul((mod - mod / i), invFact[mod % i]);
  }
  for (long long i = 1; i < mm; i++) {
    invFact[i] = mul(invFact[i - 1], invFact[i]);
  }
}
long long ncr(long long n, long long r) {
  assert(n >= 0 and r >= 0);
  if (n < r) return 0;
  return mul(mul(fact[n], invFact[r]), invFact[n - r]);
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> v(n);
  for (auto& [x, y] : v) {
    cin >> x >> y;
  }
  sort(v.begin(), v.end());
  long long ans = 0;
  priority_queue<long long, vector<long long>, greater<long long>> q;
  for (long long i = 0; i < n; ++i) {
    while (!q.empty() && q.top() < v[i].first) {
      q.pop();
    }
    long long cnt = q.size();
    q.push(v[i].second);
    if (cnt >= k - 1) {
      ans = add(ans, ncr(cnt, k - 1));
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  pre();
  for (long long i = 1; i <= t; ++i) {
    solve();
  }
  return 0;
}
