#include <bits/stdc++.h>
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
const int N = 1e5 + 2;
int ans[N];
bool p[N];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  fill(p, p + N, 1);
  p[0] = p[1] = 0;
  for (int i = 2; i * i <= N; i++)
    if (p[i] == 1)
      for (int j = i * i; j <= N; j += i) p[j] = 0;
  int n, m;
  cin >> n >> m;
  m++;
  vector<vector<int> > area(m, vector<int>());
  for (int i = 1; i < m; ++i) {
    area[i].push_back(1);
    area[i].push_back(i);
    if (p[i]) {
      continue;
    }
    for (int j = 2; j * j <= i; ++j) {
      if (i % j == 0) {
        area[i].push_back(j);
        if (j != i / j) {
          area[i].push_back(i / j);
        }
      }
    }
  }
  map<int, bool> mp;
  for (int i = 0; i < (n); i++) {
    int l, r;
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      for (auto areai : area[j]) {
        mp[areai]++;
      }
    }
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
      ans[itr->first]++;
    }
    mp.clear();
  }
  for (int i = 1; i < m; i++) cout << ans[i] << endl;
  return 0;
}
