module main; // https://yukicoder.me/problems/no/257/editorial より // インタラクティブ問題、数取りゲーム import std; void main() { // 入力 int N, K; readln.chomp.formattedRead("%d %d", N, K); // 答えの計算と出力 K++; int A = (N - 1) % K, B; writeln(A); stdout.flush(); while (true) { B = readln.chomp.to!int; if (B >= N) break; A += K; writeln(A); stdout.flush(); } }