//***** author: attacker *****//
//***** created: 17.04.2026 19:50:06 *****//
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 1
#endif
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define bpc __builtin_popcount
#define size(v) (int) (v.size())
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> res(1e6 + k + 1);
for (int i = 0; i < n; i++) {
if (k >= a[i]) continue;
for (int j = 0; j <= 1e6; j += a[i]) {
res[j + k]++;
}
}
for (int i = 0; i < n; i++) {
cout << res[a[i]] - (k == 0 ? 1 : 0) << " \n"[i == n - 1];
}
return 0;
}