#include using namespace std; int main(){ int N,K; int myTurn = -1; cin >> N >> K; myTurn = !((N-1)%(K+1) == 0); if(!myTurn)cout << 0 << endl << flush; int input = 0; while(input < N){ if(myTurn){ cout << ( input+((K+1)-((input-N%K)%(K+1)))%(K+1) ) << endl << flush; }else{ cin >> input; } myTurn = !myTurn; } return 0; }