#include #include #include #include using namespace std; int main() { int N, K; cin >> N >> K; if (N == 1) { cout << "0" << endl; cout.flush(); int op; cin >> op; return 0; } int turn = 0; bool ato = (N % (K + 1) == 1); if (ato) { cout << "0" << endl; cout.flush(); } else { int winNum = (K + 1) * turn + ((N - 1) % (K + 1)); cout << winNum << endl; cout.flush(); } while (true) { int op; cin >> op; ++turn; if (op >= N) { return 0; } int winNum = (K + 1) * turn + ((N - 1) % (K + 1)); cout << winNum << endl; cout.flush(); } }