#include int main() { int n, k; std::cin >> n >> k; std::cout << 0 << std::endl; while (true) { int num; std::cin >> num; if (num >= n)break; for (int i = 1; i < n; i++) { if (num <= i * (k + 1)) { std::cout << i * (k + 1) << std::endl; break; } } } return 0; }