#include <bits/stdc++.h>
using namespace std;
vector<int> P;
int m, n;
void bs() {
  int lo = 1, hi = m, ans = 0;
  int cnt = 0;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    cout << mid << endl;
    int t;
    cin >> t;
    if (P[cnt % n] == 0) {
      if (t == 0) {
        exit(0);
      }
      if (t == -1) {
        lo = mid + 1;
      }
      if (t == 1) {
        hi = mid - 1;
      }
    }
    if (P[cnt % n] == 1) {
      if (t == 0) {
        exit(0);
      }
      if (t == 1) {
        lo = mid + 1;
      }
      if (t == -1) {
        hi = mid - 1;
      }
    }
    cnt++;
  }
}
int main() {
  cin >> m >> n;
  P = vector<int>(n);
  for (int i = 0; i < n; i++) {
    cout << 1 << endl;
    int t;
    cin >> t;
    if (t == 0 || t == -2) exit(0);
    if (t == 1)
      P[i] = 1;
    else
      P[i] = 0;
  }
  bs();
  return 0;
}
