#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int n, m;
int w[110][110];
int p[4][110][110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n >> m, n) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> w[i][j];
      }
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
        cin >> p[0][i][j];
      }
    }
    for (int idx = 0; idx < 3; idx++) {
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
          p[idx + 1][j][m - 1 - i] = p[idx][i][j];
        }
      }
    }
    bool flag = false;
    int ay = n + 1, ax = n + 1;
    for (int i = 0; i + m <= n; i++) {
      for (int j = 0; j + m <= n; j++) {
        for (int idx = 0; idx < 4; idx++) {
          bool yes = true;
          for (int y = 0; y < m; y++) {
            for (int x = 0; x < m; x++) {
              if (p[idx][y][x] == -1) continue;
              yes &= p[idx][y][x] == w[i + y][j + x];
            }
          }
          if (!yes) continue;
          for (int y = 0; y < m; y++) {
            for (int x = 0; x < m; x++) {
              if (p[idx][y][x] == -1) continue;
              int ny = i + y + 1, nx = j + x + 1;
              if (ny <= ay) {
                ay = ny;
                if (nx <= ax) ax = nx;
              }
              y = m, x = m;
            }
          }
        }
      }
    }
    if (ax == n + 1) cout << "NA" << endl;
    else cout << ax << " " << ay << endl;
  }

  return 0;
}
