#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
bool p;
void f1(long long n) {
  for (long long i = 0; i < n; i++) {
    cout << 1 << endl;
    long long x;
    cin >> x;
    if (x == 0) {
      p = 1;
      return;
    }
    if (x == 1)
      v.push_back(1);
    else
      v.push_back(0);
  }
}
long long f(long long idx, long long n, long long l, long long r) {
  if (l == r) {
    return l;
  }
  long long mid = (l + r) / 2;
  cout << mid << endl;
  long long x;
  cin >> x;
  if (x == 0)
    return mid;
  else if (x == 1) {
    if (v[idx] == 1)
      return f((idx + 1) % n, n, mid + 1, r);
    else
      return f((idx + 1) % n, n, l, mid - 1);
  } else {
    if (v[idx] == 1)
      return f((idx + 1) % n, n, l, mid - 1);
    else
      return f((idx + 1) % n, n, mid + 1, r);
  }
}
void solve() {
  long long m, n;
  cin >> m >> n;
  f1(n);
  if (p) {
    cout << 1 << endl;
    return;
  }
  long long ans = f(0, n, 1, m);
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
