//https://ncode.syosetu.com/n4830bu/257/ #include using namespace std; int main() { int N, K; cin >> N >> K; if ((N - 1) % (K + 1) == 0) { //後攻 cout << 0 << endl; int x; while (cin >> x) { if (x >= N) return 0; cout << (x + K) / (K + 1) * (K + 1) << endl; } } else { //先攻 for (int i = 0;; i++) { cout << i * (K + 1) + (N - 1) % (K + 1) << endl; int x; cin >> x; if (x >= N) return 0; } } }