var
	x, l, r, n, z, steps, limit: longint;
	inputFile, outputFile: text;
	xs: string;

begin
	reset(inputFile, 'guess.in');
	read(inputFile, n);
	read(inputFile, limit);
	close(inputFile);



	l := 1;
	r := n;

	writeln(n);
	flush(output);

	rewrite(outputFile, 'guess.out');
	steps := 0;
	while true do begin
		readln(xs);
		val(xs, x, z);
		if (z <> 0) then begin
			writeln(outputFile, -1);
			writeln(outputFile, xs);
			close(outputFile);
			exit;
		end;

		inc(steps);

		if (l = r) and (r = x) then begin
			writeln(0);
			flush(output);
			break;
		end else if (x < l) then begin
			writeln(1);
			flush(output);
		end else if (x > r) then begin
			writeln(-1);
			flush(output);
		end else begin
			if x - l > r - x then begin
				writeln(-1);
				flush(output);
				r := x - 1;
			end else begin
				writeln(1);
				flush(output);
				l := x + 1;
			end;
		end;
			
		if (steps > limit) then
			break;
	end;

	writeln(outputFile, steps);
	close(outputFile);

	if steps > limit then
		halt(1);
end.