#include #include #include #include //#include #include #include #include #include #include //#include #include #include #include //#include #include #include //#include #include #include #include const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; typedef long long ll; typedef vector vi; typedef vector vll; typedef pair pii; typedef complex C; int main() { int N, K; cin >> N >> K; if (N%(K+1) == 1) { cout << 0 << endl; cout.flush(); int old = 0; while (1) { int x; cin >> x; if (x >= N) break; if (N-1-x <= K) { cout << N-1 << endl; continue; } else { cout << old+K+1 << endl; old += K+1; } cout.flush(); } } else { int old = 1; if (K >= N) { cout << N-1 << endl; old = N-1; } else { cout << 1 << endl; } cout.flush(); while (1) { int x; cin >> x; if (x >= N) break; if (N-1-x <= K) { cout << N-1 << endl; continue; } else { cout << old+K+1 << endl; old += K+1; } cout.flush(); } } return 0; }