#![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::().unwrap(); let A = it.next().unwrap().parse::().unwrap(); let mut s = String::new(); io::stdin().read_line(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let mut X = Vec::::new(); for _ in 0..D { let x = it.next().unwrap().parse::().unwrap(); X.push(x); } let mut ret = Vec::::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::().unwrap(); for _ in 0..T { solve() } }