#include<bits/stdc++.h> #define SINGLE_INPUT #define ll long long #define ull unsigned long long #define N 500005 #define MOD 998244353 usingnamespace std;
vector<int> p = {1, 0, 1, 0, 1, 0}; int x = 10;
intask(int y, int t){ cout << y << endl; int rt = 0; cin >> rt; return rt; // if (y > x) // rt = -1; // if (y < x) // rt = 1; // return p[t % p.size()] ? rt : -rt; }
voidsol(){ int m, n; cin >> m >> n; // m = 50, n = 6; vector<int> c(n); for (int i = 0; i < n; i++) { int rt = ask(1, i); if (rt == 0) { return; } if (rt == 1) c[i] = 1; } int l = 1, r = m + 1; for (int i = n; i < 60; i++) { int mid = l + r >> 1; int rt = ask(mid, i); if (rt == 0) { return; } if (!c[i % n]) { rt = -rt; } if (rt == 1) { l = mid + 1; } else { r = mid; } } }