#include <bits/stdc++.h>
using namespace std;
int arr[300010], brr[300010];
vector<int> v[300010];
pair<pair<int, int>, int> qu[300010];
int cnt[300010];
int ans[300010];
set<int> done;
int block;
bool sorter(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  int x = a.first.first / block;
  int y = b.first.first / block;
  if (x == y)
    return a.first.second < b.first.second;
  else
    return x < y;
}
void add(int x) {
  for (int i = 0; i < (int)v[x].size(); i++) {
    cnt[v[x][i]]++;
    if (done.find(v[x][i]) == done.end()) {
      ++ans[v[x][i]];
      done.insert(v[x][i]);
    }
  }
}
void remove(int x) {
  for (int i = 0; i < (int)v[x].size(); i++) {
    cnt[v[x][i]]--;
    if (cnt[v[x][i]] == 0) {
      done.erase(v[x][i]);
    }
  }
}
int main(int argc, char const *argv[]) {
  int n, m;
  for (int i = 1; i <= 100000; i++) {
    for (int j = i; j <= 100000; j += i) {
      v[j].push_back(i);
    }
  }
  scanf("%d%d", &n, &m);
  block = sqrt(m);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &arr[i], &brr[i]);
    qu[i] = make_pair(make_pair(arr[i], brr[i]), i);
  }
  sort(qu, qu + n, sorter);
  int mo_l, mo_r;
  mo_l = 1;
  mo_r = 0;
  for (int i = 0; i < n; ++i) {
    int l, r, ind;
    l = qu[i].first.first;
    r = qu[i].first.second;
    ind = qu[i].second;
    while (mo_r < r) {
      mo_r++;
      add(mo_r);
    }
    while (mo_r > r) {
      remove(mo_r);
      mo_r--;
    }
    while (mo_l < l) {
      add(mo_l);
      mo_l++;
    }
    while (mo_l > l) {
      mo_l--;
      remove(mo_l);
    }
  }
  for (int i = 1; i <= m; ++i) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
