import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto M = s[0].to!long;
    auto N = s[1];
    auto P = new int[](N);
    long x;
    int[] Q;
    int debug_cnt = 0;

    debug {
        x = readln.chomp.to!long;
        Q = N.iota.map!(_ => readln.chomp.to!int).array;
    }


    int ask(long y) {
        writeln(y);
        stdout.flush;
        debug {
            if (x < y) return -1 * Q[debug_cnt];
            else if (x > y) return 1 * Q[debug_cnt];
            else return 0;
            ++debug_cnt;
        }
        return readln.chomp.to!int;
    }

    foreach (i; 0..N) {
        P[i] = ask(1);
        if (P[i] == 0)
            return;
    }

    long hi = M+1;
    long lo = 0;
    int cnt = 0;

    while (hi - lo > 1) {
        long mid = (hi + lo) / 2;
        int ret = ask(mid) * P[cnt%N];
        if (ret == 1) {
            lo = mid;
        } else if (ret == -1) {
            hi = mid;
        } else {
            return;
        }
        ++cnt;
    }
}
