#include <bits/stdc++.h>
using namespace std;
long long modPower(long long num, long long r) {
  if (r == 0) return 1;
  if (r == 1) return num % 998244353;
  long long ans = modPower(num, r / 2) % 998244353;
  if (r % 2 == 0) {
    return (ans * ans) % 998244353;
  }
  return (((ans * ans) % 998244353) * num) % 998244353;
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (unsigned int i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {
  bool first = true;
  os << "[";
  for (typename std::set<T>::const_iterator iii = v.begin(); iii != v.end();
       ++iii) {
    if (!first) os << ", ";
    os << *iii;
    first = false;
  }
  return os << "]";
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {
  bool first = true;
  os << "[";
  for (typename std::map<T1, T2>::const_iterator iii = v.begin();
       iii != v.end(); ++iii) {
    if (!first) os << ", ";
    os << *iii;
    first = false;
  }
  return os << "]";
}
int dr4[] = {0, 1, 0, -1}, dc4[] = {1, 0, -1, 0};
int dr8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dc8[] = {1, 1, 0, -1, -1, -1, 0, 1};
long long inv(long long a) { return modPower(a, 998244353 - 2); }
void factorial(long long* fact, long long* factorialNumInverse, long long n) {
  fact[0] = 1;
  factorialNumInverse[0] = inv(fact[0]);
  for (int i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % 998244353;
    factorialNumInverse[i] = inv(fact[i]);
  }
}
long long nCr(long long n, long long r, long long* fact,
              long long* factorialNumInverse) {
  long long ans = (((fact[n] * factorialNumInverse[r]) % 998244353) *
                   factorialNumInverse[n - r]) %
                  998244353;
  return ans;
}
bool comp(pair<long long, long long>& a, pair<long long, long long>& b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long factorialNumInverse[n + 1];
  long long fact[n + 1];
  factorial(fact, factorialNumInverse, n);
  vector<pair<long long, long long> > a;
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    a.push_back({l, 1});
    a.push_back({r, -1});
  }
  sort(a.begin(), a.end(), comp);
  vector<long long> peaks;
  long long sum = 0;
  for (auto it : a) {
    sum += it.second;
    peaks.push_back(sum);
  }
  long long sz = peaks.size(), ans = 0, prev = -1;
  bool init = false;
  for (long long i = 0; i < sz - 1; i++) {
    if (peaks[i] == k && !init) {
      init = true;
      ans = 1;
    } else if (init) {
      if (peaks[i] >= k && peaks[i] > peaks[i - 1]) {
        long long mul;
        if (prev == -1) {
          mul = nCr(peaks[i] - 1, k - 1, fact, factorialNumInverse);
        } else {
          mul = (mul * (peaks[i] - 1)) % 998244353;
        }
        ans = (ans + mul) % 998244353;
      } else {
        prev = -1;
      }
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
