#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long INF = 1LL << 60;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long query(long long x) {
  cout << x << endl;
  fflush(stdout);
  long long res;
  cin >> res;
  if (res == 0) exit(0);
  assert(res != -2);
  return res;
}
void solve() {
  long long m, n;
  cin >> m >> n;
  vector<long long> check(n);
  for (long long i = 0; i < n; ++i) {
    check[i] = query(1);
  }
  long long le = 1, ri = m + 1;
  long long i = 0;
  while (ri - le > 1) {
    long long mid = (le + ri) / 2;
    long long res = query(mid);
    if (check[i] == 1) {
      if (res == 1)
        le = mid;
      else
        ri = mid;
    } else {
      if (res == 1)
        ri = mid;
      else
        le = mid;
    }
    i = (i + 1) % n;
  }
  query(le);
  assert(false);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
