#include <bits/stdc++.h>
using namespace std;
int l[300000 + 60], r[300000 + 60], n;
int ans[100000 + 60], m;
bool vis[100000 + 80];
int pri[300000 + 80];
void prepare(int x) {
  int i, j, k = sqrt(x + 0.5);
  for (i = 2; i <= k; i++) {
    if (vis[i] == 0) {
      pri[++pri[0]] = i;
      for (j = i * i; j <= 100000; j += i) vis[j] = 1;
    }
  }
  while (i <= x) {
    if (vis[i] == 0) pri[++pri[0]] = i;
    i++;
  }
  return;
}
void sol(int num, int s, int pos) {
  if (r[pos] / num == (l[pos] - 1) / num) return;
  if (vis[num] == 0) {
    vis[num] = 1;
    ans[num]++;
  }
  if (s > pri[0]) return;
  do {
    sol(num, s + 1, pos);
    if (num > m / pri[s]) break;
    num *= pri[s];
  } while (1);
  return;
}
int main() {
  int i;
  scanf("%d%d", &n, &m);
  prepare(m);
  for (i = 1; i <= n; i++) scanf("%d%d", l + i, r + i);
  for (i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    sol(1, 1, i);
  }
  for (i = 1; i <= m; i++) printf("%d\n", ans[i]);
  return 0;
}
