#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T; cin >> T;
    while(T--){
        long long D,A; cin >> D >> A;
        while(D--){
            long long x; cin >> x;
            long long now = x/A;
            x %= A;
            if(x >= (A+1)/2) now++;
            cout << now << " ";
        }
        cout << endl;
    }
}