#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return string(s); }
string to_string(string s) { return s; }
string to_string(vector<bool> v) {
  string res;
  for (int i = 0; i < (int)v.size(); i++) res += char('0' + v[i]);
  return res;
}
template <size_t second>
string to_string(bitset<second> b) {
  string res;
  for (int i = 0; i < second; i++) res += char('0' + b[i]);
  return res;
}
template <class T>
string to_string(T v) {
  bool f = 1;
  string res;
  for (auto x : v) {
    if (!f) res += ' ';
    f = 0;
    res += to_string(x);
  }
  return res;
}
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
const int INF = 1e9 + 7;
bool local = false;
int a[100][100];
map<pair<int, int>, int> save;
int ask(int x, int y) {
  if (local)
    return a[x - 1][y - 1];
  else {
    if (save.count({x, y})) return save[{x, y}];
    cout << "? " << x << " " << y << endl;
    cin >> save[{x, y}];
    return save[{x, y}];
  }
}
vector<int> reduce(vector<int> rows, vector<int> cols) {
  vector<int> stk;
  for (int i = 0; i < cols.size(); i++) {
    while (true) {
      if (stk.empty()) {
        stk.push_back(cols[i]);
        break;
      } else {
        if (ask(rows[stk.size() - 1], stk.back()) <=
            ask(rows[stk.size() - 1], cols[i])) {
          if (stk.size() + 1 <= rows.size()) {
            stk.push_back(cols[i]);
            break;
          } else {
            break;
          }
        } else {
          stk.pop_back();
        }
      }
    }
  }
  return stk;
}
vector<int> SMAWK(vector<int> rows, vector<int> cols) {
  if (rows.empty()) return vector<int>();
  if (rows.size() < cols.size()) cols = reduce(rows, cols);
  vector<int> rec_rows;
  for (int i = 1; i < rows.size(); i += 2) rec_rows.push_back(rows[i]);
  vector<int> rec_cols = SMAWK(rec_rows, cols);
  vector<int> ans_cols;
  int last_idx = 0;
  for (int i = 0; i < rows.size(); i++) {
    if (i & 1)
      ans_cols.push_back(rec_cols[i / 2]);
    else {
      int nxt_col = cols.back();
      if (i + 1 < rows.size()) nxt_col = rec_cols[(i + 1) / 2];
      int mn = ask(rows[i], cols[last_idx]), mn_col = cols[last_idx];
      while (last_idx + 1 < cols.size() && cols[last_idx + 1] <= nxt_col) {
        last_idx++;
        int nw = ask(rows[i], cols[last_idx]);
        if (nw < mn) mn = nw, mn_col = cols[last_idx];
      }
      ans_cols.push_back(mn_col);
    }
  }
  return ans_cols;
}
signed main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  if (local)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) cin >> a[i][j];
  vector<int> rows, cols;
  for (int i = 1; i <= n; i++) rows.push_back(i);
  for (int i = 1; i <= m; i++) cols.push_back(i);
  vector<int> mn_cols = SMAWK(rows, cols);
  int mn = INF;
  for (int i = 0; i < n; i++) mn = min(mn, ask(rows[i], mn_cols[i]));
  cout << "! " << mn << endl;
}
