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