#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N,K; cin >> N >> K; vector V; auto push = [&](int v) { cout << v << endl; cout.flush(); V.push_back(v); }; push((N - 1) % (K + 1)); while(true) { int X; cin >> X; if(X >= N) { return 0; } else { int D = X - V.back(); int A = (K + 1) - D; push(X + A); } } }