#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef double db;

const int limit = 1e9;
const int QLIMIT = 500;
const int INTEGRITY = 913611539;

enum Status {OK, WRONG_ANSWER, WRONG_INTERACTION, Q_LIMIT_EXCEEDED, Q_LIMIT_PARTIAL};

int noOfPoints;

void judge(const Status& res) {
  if(res != OK)
    cout << -1 << endl;

  ofstream fout("cbinteractiv.out");

  fout << INTEGRITY << '\n';
  fout << res << '\n';

  fout.close();
  exit(0);
}

main() {
  ifstream fin("cbinteractiv.in");
  assert(fin);
  int grader_mode, n;
  assert(fin >> grader_mode);
  assert(fin >> n);
  if(grader_mode == 1) {
    int target;
    assert(fin >> target);
    std::cout << n << endl;
    int steps = 0;
    while( steps <= QLIMIT) {
	  steps += 1;
      char op;
      int val;
      std::cin >> op >> val;
      if(op == '?') {
        if(1 <= val && val <= n) {
          if(target > val)
            std::cout << 0 << endl;
          else if(target <= val)
            std::cout << 1 << endl;
        } else {
          std::cout << -1 << endl;
          judge(WRONG_INTERACTION);
        }
      } else {
        if(val == target) {
          if(steps <= 32)
            judge(OK);
          else if(steps <= n)
            judge(Q_LIMIT_PARTIAL);
          else
            judge(Q_LIMIT_EXCEEDED);
        } else
          judge(WRONG_ANSWER);
      }
    }
    judge(Q_LIMIT_EXCEEDED);
  } else {
    int from = 1, to = n;
    std::cout << n << endl;
    int steps = 0;
    while(steps <= QLIMIT) {
	  steps += 1;
      char op;
      int val;
      std::cin >> op >> val;
      if(op == '?') {
        if(1 <= val && val <= n) {
          if(from <= val && val <= to) {
            if((val - from + 1) < to - val) {
              std::cout << 0 << endl;
              from = val + 1;
            } else {
              std::cout << 1 << endl;
              to = val;
            }
          } else if(from > from)
            std::cout << 0 << endl;
          else if(from <= from)
            std::cout << 1 << endl;
        } else {
          std::cout << -1 << endl;
          judge(WRONG_INTERACTION);
        }
      } else {
        if(from == to && val == from) {
          if(steps <= 32)
            judge(OK);
          else if(steps <= n)
            judge(Q_LIMIT_PARTIAL);
          else
            judge(Q_LIMIT_EXCEEDED);
        } else
          judge(WRONG_ANSWER);
      }
    }
    judge(Q_LIMIT_EXCEEDED);
  }
}
