#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fs first
#define sc second
#define mp make_pair
typedef pair<int, int> pii;
typedef pair<pii, int> p3i;
const int MXN = 300005, MXM = 1000005;
int n, k, a[MXN], c[MXM], p[MXM], d[MXM];
void miku() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
c[a[i]]++;
}
for (int i = 0; i < MXM - 1; i++) p[i + 1] = p[i] + c[i];
for (int i = k + 1; i < MXM; i++) {
for (int j = 0; j < MXM; j += i) {
d[j] += c[i];
}
}
for (int i = 0; i < n; i++) {
if (a[i] < k) cout << 0 << ' ';
else if (a[i] == k) cout << p[MXM - 1] - p[a[i] + 1] << ' ';
else {
if (k == 0) cout << d[a[i]] - 1 << ' ';
else cout << d[a[i] - k] << ' ';
}
}
cout << endl;
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
miku();
return 0;
}