#include <bits/stdc++.h>
using namespace std;
bool used[10000005];
int ans[105];
bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second == b.first.second) return a.first.first < b.first.first;
  return a.first.second < b.first.second;
}
void solve() {
  int a, b;
  cin >> a >> b;
  int x[a][b];
  int cur = 1;
  if (a > 3) {
    for (int i = 0; i < b; i++) {
      for (int j = a / 2; j < a; j++) {
        x[j][i] = cur;
        cur++;
        if (a % 2 == 0 || j != a - 1) {
          x[j - a / 2][i] = cur;
          cur++;
        }
      }
    }
  } else if (b > 3) {
    for (int i = 0; i < a; i++) {
      for (int j = b / 2; j < b; j++) {
        x[i][j] = cur;
        cur++;
        if (b % 2 == 0 || j != b - 1) {
          x[i][j - b / 2] = cur;
          cur++;
        }
      }
    }
  } else {
    if (a == 1 && b == 1) {
      cout << 1;
      return;
    }
    if (a <= 2 && b <= 2) {
      cout << -1;
      return;
    } else if (b == 1 || a == 1) {
      cout << -1;
      return;
    } else if (a == 2) {
      cout << "3 6 2\n5 1 4";
      return;
    } else if (b == 2) {
      cout << "3 5\n6 1\n2 4";
      return;
    } else {
      cout << "2 8 3" << '\n';
      cout << "4 1 5" << '\n';
      cout << "6 9 7" << '\n';
      return;
    }
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      cout << x[i][j] << " ";
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
