#include <bits/stdc++.h>
using namespace std;
unordered_set<int> commonSet(unordered_set<int> &a, unordered_set<int> &b) {
  unordered_set<int> c;
  for (int i : a)
    if (b.find(i) != b.end()) c.insert(i);
  return c;
}
bool isPrime(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
void getDivisors(int x, vector<int> &v) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0 && isPrime(i)) v.push_back(i);
}
bool hasMultiInRange(int l, int r, int x) {
  if (l <= (r / x) * x) {
    return true;
  } else {
    return false;
  }
}
void getGoodsFromTrainNo(int n, int *l, int *r, int x, unordered_set<int> &s) {
  for (int i = 0; i < n; i++) {
    if (hasMultiInRange(l[i], r[i], x)) {
      s.insert(i);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  int l[n], r[n];
  for (int i = 0; i < n; i++) cin >> l[i] >> r[i];
  cout << n << endl;
  unordered_set<int> goodsFromTrainNo[m + 1];
  for (int i = 2; i <= m; i++) {
    vector<int> divisors;
    getDivisors(i, divisors);
    if (divisors.size() <= 1) {
      getGoodsFromTrainNo(n, l, r, i, goodsFromTrainNo[i]);
      cout << goodsFromTrainNo[i].size() << endl;
    } else {
      unordered_set<int> goods;
      goods = commonSet(goodsFromTrainNo[divisors[0]],
                        goodsFromTrainNo[divisors[1]]);
      for (int i = 2; i < divisors.size(); i++) {
        goods = commonSet(goods, goodsFromTrainNo[divisors[i]]);
      }
      cout << goods.size() << endl;
    }
  }
}
