#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans = 1e9;
int qry(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
  int z;
  scanf("%d", &z);
  ans = min(ans, z);
  return z;
}
vector<int> sol(vector<int> r, vector<int> c) {
  if (((int)(r).size()) <= 2) {
    vector<int> res(((int)(r).size()), 1e9);
    for (int i = (0); i <= (((int)(r).size()) - 1); ++i) {
      int mn = 1e9;
      for (int j = (0); j <= (((int)(c).size()) - 1); ++j) {
        int num = qry(r[i], c[j]);
        if (num < mn) {
          mn = num;
          res[i] = c[j];
        }
      }
    }
    return res;
  }
  if (((int)(r).size()) < ((int)(c).size())) {
    vector<int> nc;
    for (int i = (0); i <= (((int)(c).size()) - 1); ++i) {
      while (((int)(nc).size()) &&
             qry(r[((int)(nc).size()) - 1], c[i]) <
                 qry(r[((int)(nc).size()) - 1], nc.back())) {
        nc.pop_back();
      }
      if (((int)(nc).size()) < ((int)(r).size())) {
        nc.push_back(c[i]);
      }
    }
    return sol(r, nc);
  } else {
    vector<int> nr;
    for (int i = 0; i < ((int)(r).size()); i += 2) {
      nr.push_back(r[i]);
    }
    vector<int> ores(sol(nr, c));
    vector<int> res(((int)(r).size()));
    for (int i = (0); i <= (((int)(ores).size()) - 1); ++i) {
      res[i * 2] = ores[i];
    }
    for (int i = 1; i < ((int)(r).size()); i += 2) {
      int lb = lower_bound(c.begin(), c.end(), ores[i / 2]) - c.begin();
      int rb =
          i + 1 >= ((int)(r).size())
              ? ((int)(c).size()) - 1
              : lower_bound(c.begin(), c.end(), ores[i / 2 + 1]) - c.begin();
      int mn = 1e9;
      for (int j = (lb); j <= (rb); ++j) {
        int num = qry(r[i], c[j]);
        if (num < mn) {
          mn = num;
          res[i] = c[j];
        }
      }
    }
    return res;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  vector<int> r, c;
  for (int i = (1); i <= (n); ++i) r.push_back(i);
  for (int i = (1); i <= (m); ++i) c.push_back(i);
  vector<int> res(sol(r, c));
  printf("! %d\n", ans);
  return 0;
}
