#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int m, n;
  cin >> m >> n;
  int l = m, f = 1, check, ans;
  int behaviour[n];
  for (int i = 0; i < n; i++) {
    cout << "1\n";
    cin >> behaviour[i];
    if (behaviour[i] == 0) cout << "1\n";
  }
  for (int i = 0; i < 30; i++) {
    if (l <= f) {
      cout << l;
      break;
    }
    check = (l + f) / 2;
    cout << check << endl;
    cin >> ans;
    if (ans == 0) break;
    if (i >= n) {
      i -= n;
    }
    ans = ans * behaviour[i];
    if (ans == 1) {
      f = check + 1;
    } else {
      l = check - 1;
    }
  }
  return 0;
}
