#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
constexpr long long INF = (long long)1e18;
template <typename T>
class lazy_segment_tree {
  long long n;
  T fval;
  vector<T> dat, lazy;

 public:
  lazy_segment_tree() {}
  lazy_segment_tree(long long n_, T val) { init(n_, val); }
  ~lazy_segment_tree() {}
  void init(long long n_, T val) {
    fval = val;
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1);
    lazy.resize(2 * n - 1, fval);
    for (long long i = 0; i < 2 * n - 1; i++) dat[i] = fval;
  }
  void eval(long long k, long long l, long long r) {
    if (lazy[k] != fval) {
      dat[k] = dat[k] + lazy[k];
      if (r - l > 1) {
        lazy[2 * k + 1] = lazy[2 * k + 1] + lazy[k] / 2;
        lazy[2 * k + 2] = lazy[2 * k + 2] + lazy[k] / 2;
      }
      lazy[k] = fval;
    }
  }
  void update(long long a, long long b, T x, long long k = 0, long long l = 0,
              long long r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (b <= l || r <= a) {
      return;
    }
    if (a <= l && r <= b) {
      lazy[k] = lazy[k] + (r - l) * x;
      eval(k, l, r);
    } else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      dat[k] = dat[2 * k + 1] + dat[2 * k + 2];
    }
  }
  T query(long long a, long long b, long long k = 0, long long l = 0,
          long long r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) {
      return fval;
    }
    if (a <= l && r <= b) {
      return dat[k];
    } else {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return vl + vr;
    }
  }
};
signed main() {
  lazy_segment_tree<long long> seg;
  long long N, M;
  vector<pair<long long, pair<long long, long long>>> in;
  vector<long long> con, pn;
  cin >> N >> M;
  seg.init(M + 10, 0);
  in.resize(N);
  con.resize(M + 3);
  pn.push_back(1);
  for (long long i = 2; i <= M; i++) {
    bool flag = false;
    for (long long j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        flag = true;
        break;
      }
    }
    if (flag == false) {
      pn.push_back(i);
    }
  }
  for (long long i = 0; i < N; i++) {
    cin >> in[i].second.first >> in[i].second.second;
    in[i].first = in[i].second.second - in[i].second.first + 1;
    con[in[i].second.first]++;
    con[in[i].second.second + 1]--;
  }
  sort(in.begin(), in.end());
  for (long long i = 1; i <= M; i++) {
    con[i] += con[i - 1];
  }
  for (long long i = 1, j = 0; i <= M; i++) {
    long long res = 0;
    for (; j < N; j++) {
      if (in[j].first >= i) break;
      seg.update(in[j].second.first, in[j].second.second + 1, 1);
    }
    for (long long j = 0; j < (long long)pn.size(); j++) {
      if (pn[j] * i > M) break;
      res += seg.query(pn[j] * i, pn[j] * i + 1);
    }
    res += N - j;
    cout << res << "\n";
  }
  return 0;
}
