#include <bits/stdc++.h>
using namespace std;
std::mt19937 rng(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long cdiv(long long a, long long b) {
  return a / b + ((a ^ b) > 0 && a % b);
}
long long fdiv(long long a, long long b) {
  return a / b - ((a ^ b) < 0 && a % b);
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long b, long long e, long long m) {
  b %= m;
  long long ans = 1;
  for (; e; b = b * b % m, e /= 2)
    if (e & 1) ans = ans * b % m;
  return ans;
}
void dbg_out() { cerr << "\n"; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
const int N = 100100;
int l[N], r[N];
long long dp[N], pre[N];
const int M = 998244353;
long long tot[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  for (int i = 1; i < (n + 1); ++i) cin >> l[i] >> r[i];
  for (int V = 1; V < (m + 1); ++V) {
    int mx = m / V;
    for (int i = 0; i < (mx + 1); ++i) pre[i] = dp[i] = 0;
    dp[0] = 1;
    for (int i = 0; i < (mx + 1); ++i) pre[i] = 1;
    int bad = 0;
    for (int k = 1; k < (n + 1); ++k) {
      int L = (l[k] + V - 1) / V;
      int R = r[k] / V;
      if (R == 0 || L > R) {
        bad = 1;
        break;
      }
      for (int i = 0; i < (mx + 1); ++i) {
        if (i - L >= 0)
          dp[i] = (M + pre[i - L] - (i - R - 1 >= 0 ? pre[i - R - 1] : 0)) % M;
        else
          dp[i] = 0;
      }
      for (int i = 0; i < (mx + 1); ++i) {
        pre[i] = dp[i] % M;
        if (i) pre[i] = (pre[i] + pre[i - 1]) % M;
      }
    }
    tot[V] = (bad ? 0 : pre[mx]);
  }
  for (int i = m; i >= 1; i--) {
    for (int j = i * 2; j <= m; j += i) {
      tot[i] -= tot[j];
      tot[i] %= M;
      if (tot[i] < 0) tot[i] += M;
    }
  }
  cout << tot[1] << "\n";
}
