#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { long long N,K; cin >> N >> K; bool turn = (N-1)%(K+1) > 0; if ( (N-1)%(K+1) == 0 ) { cout << 0 << endl << flush; } long long a = 0; long long diff = 0; long long temp; while ( true ) { if ( turn ) { if ( a == 0 ) { a = (N-1)%(K+1); } else { a += ( K+1 )-diff; } cout << a << endl << flush; } else { cin >> temp; if ( temp >= N ) { return 0; } diff = temp - a; a = temp; } turn = !turn; } return 0; }