#include <bits/stdc++.h>
using namespace std;
int matrix[500][500];
int main() {
  deque<int> ans1(4);
  ans1[0] = 2;
  ans1[1] = 4;
  ans1[2] = 1;
  ans1[3] = 3;
  int n, m;
  cin >> n >> m;
  int a = n, b = m;
  ;
  if (a > b) swap(a, b);
  if (a == 1 && b == 1)
    cout << 1;
  else if ((a == 1 && b < 4) || (a == 2 && b < 3))
    cout << -1;
  else {
    if (a == 1) {
      for (int i = 5; i <= b; i++)
        if (i % 2)
          ans1.push_back(i);
        else
          ans1.push_front(i);
      for (int i = 0; i < ans1.size(); i++)
        cout << ans1[i] << (n == 1 ? ' ' : '\n');
    } else {
      matrix[0][0] = 3;
      matrix[0][1] = 6;
      matrix[0][2] = 2;
      matrix[1][0] = 5;
      matrix[1][1] = 1;
      matrix[1][2] = 4;
      int lastint = 7;
      for (int i = 2; i < a; i++)
        for (int j = 0; j < 3; j++) {
          matrix[i][j] = lastint++;
          if (j % 2) swap(matrix[i][j], matrix[i - 1][j]);
        }
      for (int i = 3; i < b; i++)
        for (int j = 0; j < a; j++) {
          matrix[j][i] = lastint++;
          if (j % 2) swap(matrix[j][i], matrix[j][i - 1]);
        }
      if (a == n)
        for (int i = 0; i < a; i++, cout << endl)
          for (int j = 0; j < b; j++) cout << matrix[i][j] << ' ';
      else
        for (int i = 0; i < b; i++, cout << endl)
          for (int j = 0; j < a; j++) cout << matrix[j][i] << ' ';
    }
  }
  return 0;
}
