#include <bits/stdc++.h>
using namespace std;
inline void out(int x) { cout << x << endl << flush; }
const int maxn = 40;
int m, n, x;
int p[maxn];
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> m >> n;
  out(1);
  cin >> x;
  if (x == 0) return 0;
  p[0] = x > 0;
  for (int i = 1; i < n; i++) {
    out(1);
    cin >> x;
    p[i] = x > 0;
  }
  int lo = 2, hi = m + 1, cnt = 0, mid;
  while (hi - lo > 1) {
    mid = hi + lo >> 1;
    out(mid);
    cin >> x;
    if (x == 0) return 0;
    bool gt = (x == 1 and p[cnt] == 1) or (x == -1 and p[cnt] == 0);
    if (gt)
      lo = mid + 1;
    else
      hi = mid;
    cnt++;
    cnt %= n;
  }
  out(lo);
  cin >> x;
  assert(x == 0);
}
