#include <bits/stdc++.h>
long ans[100000];
int f[1000001];
int main() {
  long n, m, i, l, r, len, j, k;
  scanf("%ld %ld", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%ld %ld", &l, &r);
    len = r - l + 1;
    for (j = 1; j <= r; j++) {
      if (f[j] == 1) {
        f[j] = 0;
        continue;
      }
      if (len >= j) {
        ans[j - 1]++;
        continue;
      }
      k = l % j;
      if (k == 0 || j - k < len) {
        ans[j - 1]++;
        continue;
      }
      for (k = j * 2; k <= r; k += j) {
        f[k] = 1;
      }
    }
  }
  for (i = 0; i < m; i++) {
    printf("%ld\n", ans[i]);
  }
  return 0;
}
