#include <bits/stdc++.h>
using namespace std;
long long a[31];
void query(long long i) {
  long long x;
  cout << i << "\n";
  cout.flush();
  cin >> x;
  if (x != 0 && x != 1 && x != -1) {
    exit(0);
  }
  if (x == 0) {
    cout << i << "\n";
    cout.flush();
    exit(0);
  }
}
void query2(long long i) {
  long long x;
  cout << i << "\n";
  cout.flush();
  cin >> x;
  if (x != 0 && x != 1 && x != -1) {
    exit(0);
  }
  if (x == 0) {
    exit(0);
  } else if (x == 1) {
    a[i - 1] = 1;
  } else
    a[i - 1] = 0;
}
long long query3(long long x, long long z) {
  long long y;
  cout << x;
  cout << "\n";
  cout.flush();
  cin >> y;
  if (y != 0 && y != 1 && y != -1) {
    exit(0);
  }
  if (y == 0) {
    exit(0);
  }
  if (a[z] == 1)
    return y;
  else
    return -1 * y;
}
int main() {
  long long m, n;
  cin >> m >> n;
  if (m <= 60) {
    for (long long i = 1; i <= m; i++) {
      query(i);
    }
  } else {
    for (long long i = 1; i <= n; i++) query2(i);
    long long l = n + 1, r = m;
    long long cnt = 0;
    long long ans = -1;
    while (r >= l) {
      long long mid = (r + l) / 2;
      if (query3(mid, cnt) == 1) {
        l = mid + 1;
      } else {
        r = mid - 1;
      }
      cnt = (cnt + 1) % n;
    }
    query3(l, cnt);
  }
  return 0;
}
