#include <bits/stdc++.h>
using namespace std;
long long strToInt(string& a) {
  stringstream x(a);
  long long b;
  x >> b;
  return b;
}
void readI(long long& a) { cin >> a; }
void readI(long long& a, long long& b) { cin >> a >> b; }
void readI(long long& a, long long& b, long long& c) { cin >> a >> b >> c; }
vector<long long> readVI(long long n) {
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  return a;
}
vector<vector<long long> > readVVI(long long n, long long m) {
  vector<vector<long long> > a(n, vector<long long>(m));
  for (long long i = 0; i < n; i++) a[i] = readVI(m);
  return a;
}
vector<long long> readVLL(long long n) {
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  return a;
}
vector<vector<long long> > readVVLL(long long n, long long m) {
  vector<vector<long long> > a(n, vector<long long>(m));
  for (long long i = 0; i < n; i++) a[i] = readVLL(m);
  return a;
}
void print(vector<long long>& a) {
  for (auto el : a) {
    cout << el << ' ';
  }
  cout << '\n';
}
void print(vector<long long>& a, long long n) {
  long long cnt = 0;
  for (auto el : a) {
    if (cnt++ == n) break;
    cout << el << ' ';
  }
  cout << '\n';
}
const long long MOD = 998244353;
const long long INF = INT_MAX;
const long long INFF = INT64_MAX;
const double EPS = 1e-9;
const double PI = acos(-1.0);
vector<long long> fact;
long long modInverse(long long a) {
  long long ans = 1, pow = MOD - 2;
  a = a % MOD;
  while (pow > 0) {
    if (pow & 1) ans = (ans * a) % MOD;
    pow >>= 1;
    a = (a * a) % MOD;
  }
  return ans % MOD;
}
long long add(long long n, long long r) {
  if (r > n) return 0;
  return ((fact[n] * modInverse(fact[r])) % MOD *
          (modInverse(fact[n - r]) % MOD)) %
         MOD;
}
void go() {
  long long n, m;
  cin >> n >> m;
  vector<vector<long long> > lamps = readVVLL(n, 2);
  set<long long> nums;
  unordered_map<long long, long long> index;
  for (auto el1 : lamps)
    for (auto el : el1) nums.insert(el);
  long long idx = 0;
  for (auto el : nums) {
    index[el] = idx++;
  }
  n = idx;
  vector<long long> dp(n + 10, 0), reduce(n + 10, 0);
  long long ans = 0;
  fact.resize(1e6);
  fact[1] = fact[0] = 1;
  for (long long i = 1; i < 1e6; i++) fact[i] = fact[i - 1] * i % MOD;
  for (auto el : lamps) {
    dp[index[el[0]]]++, dp[index[el[1]] + 1]--, reduce[index[el[1]] + 1]++;
  }
  for (long long i = 0; i < n - 1; i++) {
    if (i > 0) dp[i] += dp[i - 1];
    if (dp[i] >= m) {
      ans = (MOD + add(dp[i], m) - add(dp[i] - reduce[i + 1], m) + ans) % MOD;
    }
  }
  ans = (MOD + ans + add(reduce[n], m)) % MOD;
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) go();
  return 0;
}
