#include <bits/stdc++.h>
using namespace std;
const int Inf = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  auto ask = [&](int x, int y) {
    cout << "? " << x + 1 << ' ' << y + 1 << endl;
    int ret;
    cin >> ret;
    return ret;
  };
  int bc = -1, val = Inf;
  for (int j = 0; j < m; ++j) {
    int cur = ask(0, j);
    if (cur < val) {
      val = cur;
      bc = j;
    }
  }
  int ans = Inf;
  for (int i = 0; i < n; ++i) {
    ans = min(ans, ask(i, bc));
  }
  cout << "! " << ans << endl;
}
