#![allow(non_snake_case)]
use std::io;

fn solve() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let D = it.next().unwrap().parse::<i32>().unwrap();
    let A = it.next().unwrap().parse::<i64>().unwrap();

    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let mut X = Vec::<i64>::new();
    for _ in 0..D {
        let x = it.next().unwrap().parse::<i64>().unwrap();
        X.push(x);
    }

    let mut ret = Vec::<i64>::new();
    for x in X {
        let a = x / A;
        let b = x % A;
        let val = a + (2 * b >= A) as i64;
        ret.push(val);
    }

    for i in 0..ret.len() {
        if i > 0 {
            print!(" ");
        }
        print!("{}", ret[i]);
    }
    println!();
}

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let T = it.next().unwrap().parse::<i64>().unwrap();

    for _ in 0..T {
        solve()
    }
}