#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, m;
int field[110][110];
int map[110][110];
int temp[110][110];
int diffx;
int diffy;

void Rotate() {
  REP(y, m) {
    REP(x, m) {
      temp[y][x] = map[x][m - y - 1];
    }
  }
  memcpy(map, temp, sizeof(map));
  REP(y, m) {
    REP(x, m) {
      if (map[y][x] != -1) { diffx = x; diffy = y; return; }
    }
  }
}

int main() {
  while (scanf("%d %d", &n, &m), n|m) {
    pair<int, int> ans = make_pair(100000, 100000);
    REP(y, n) {
      REP(x, n) {
        scanf("%d", &field[y][x]);
      }
    }
    REP(y, m) {
      REP(x, m) {
        scanf("%d", &map[y][x]);
      }
    }
    REP(i, 4) {
      Rotate();
      REP(sy, n) {
        if (sy + m > n) { continue; }
        REP(sx, n) {
          if (sx + m > n) { continue; }
          REP(y, m) {
            REP(x, m) {
              if (map[y][x] != -1 &&
                  field[sy + y][sx + x] != map[y][x]) { goto next; }
            }
          }
          ans = min(ans, make_pair(sy + diffy, sx + diffx));
next:;
        }
      }
    }
    if (ans.first >= n) {
      printf("NA\n");
    } else {
      printf("%d %d\n", ans.second + 1, ans.first + 1);
    }
  }
}