#include <bits/stdc++.h>
using namespace std;
int n, m, smt[100000 * 4 + 1], added[100000 + 1], pr[100000], cp[100000][2],
    dd[100000 + 1];
int rdup(int x, int d) { return (x % d == 0) ? x / d : x / d + 1; }
void pp() {
  for (int i = 2; i <= m; ++i)
    if (pr[i] == 0)
      for (int j = i; j <= m; j += i)
        if (pr[j] == 0) pr[j] = i;
}
void adddiv(int x, int id) {
  int cntp = 0;
  int cr = 1;
  while (x > 1) {
    if (pr[x] > cr) {
      ++cntp;
      cp[cntp][0] = 1;
      cp[cntp][1] = pr[x];
    } else
      ++cp[cntp][0];
    x /= pr[x];
  }
  int mx = 1;
  for (int i = 1; i <= cntp; ++i) mx *= cp[i][0] + 1;
  for (int i = 0; i < mx; ++i) {
    int num = 1, tmp = i;
    ;
    for (int j = 1; j <= cntp; ++j) {
      for (int l = tmp % (cp[j][0] + 1); l > 0; --l) num *= cp[j][1];
      tmp /= (cp[j][0] + 1);
    }
    if (dd[num] != id) {
      ++added[num];
      dd[num] = id;
    }
  }
}
void upd1(int x, int v) {
  for (; x > 0; x &= x - 1) smt[x] += v;
}
void upd(int l, int r) {
  upd1(r, 1);
  upd1(l - 1, -1);
}
int get(int x) {
  int sum = 0;
  for (; x <= m; x += x & (-x)) sum += smt[x];
  return sum;
}
int main() {
  cin >> n >> m;
  pp();
  for (int q = 1; q <= n; ++q) {
    int l, r;
    cin >> l >> r;
    if (r - l < 100)
      for (int i = l; i <= r; ++i) adddiv(i, q);
    else {
      upd(1, r - l + 1);
      int cl = r + 1;
      for (int d = 1; r / d > r - l + 1; ++d) {
        int ll = max(r - l + 2, rdup(l, d)), rr = min(r / d, cl);
        cl = ll;
        if (rr < ll) continue;
        upd(ll, rr);
      }
    }
  }
  for (int i = 1; i <= m; ++i) cout << added[i] + get(i) << '\n';
  return 0;
}
