#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mid (start+end)/2
#define OYY 1000005
#define ordu ios_base::sync_with_stdio(false);cin.tie(NULL);
map <int,int> mp;
int as[OYY];
int32_t main(){
ordu
int t=1;//cin>>t;
while(t--){
mp.clear();
int n,k;cin>>n>>k;
int dizi[n];
for(int i=0;i<n;i++){
cin>>dizi[i];
mp[dizi[i]]++;
}
map <int,int> ::iterator it=mp.begin();
while(it!=mp.end()){
if(it->first<=k){
it++;
continue;
}
for(int j=k;j<OYY;j+=it->first){
as[j]+=it->second;
}
if(k==0)as[it->first]--;
//cout<<"Lost in japan"<<endl;;
it++;
}
for(int i=0;i<n;i++){
cout<<as[dizi[i]]<<" ";
}
cout<<'\n';
}
return 0;
}