#include <bits/stdc++.h>
using namespace std;
int w[40];
int main() {
  int m, n;
  cin >> m >> n;
  for (int i = 1; i <= n; i++) {
    cout << 1 << endl;
    cin >> w[i];
    if (w[i] == 0) {
      return 0;
    }
  }
  int l = 1, r = m;
  int index = 1;
  while (l <= r) {
    int mid = (l + r) / 2;
    cout << mid << endl;
    int q;
    cin >> q;
    if (q == 0) return 0;
    if (q == w[(index - 1) % n + 1]) {
      l = mid + 1;
    } else {
      r = mid;
    }
    index++;
  }
  return 0;
}
