#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; if ((n - 1) % (k + 1) == 0) { cout << 0 << endl; } else { cout << (n - 1) % (k + 1) << endl; } while (true) { int ret; cin >> ret; if (ret >= n) { return 0; } int md = ret % (k + 1); cout << ret + (k + 1 - md) << endl; } }