#include int main() { int n, k; std::cin >> n >> k; if (n - 1 <= k) { std::cout << n - 1 << std::endl; int num; std::cin >> num; return 0; } 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; }