#include<bits/stdc++.h>
#define P pair<int,int>
using namespace std;

int a, b;
vector<P>V;
int c[100][100];
int f[50][50];
int g[50][50];
void kaiten() {
	int sum = 0;
	for (int i = 0; i < b;i++) {
		for (int j = b - 1; j >= 0;j--, sum++) {
			g[sum / b][sum%b] = f[j][i];
		}
	}
	for (int i = 0; i < b; i++) {
		for (int j = 0; j < b; j++) {
			f[i][j] = g[i][j];
		}
	}
}
signed main(){
	while (cin >> a >> b, a | b) {
		V.clear();
		for (int d = 0; d < a; d++) {
			for (int e = 0; e < a; e++) {
				scanf("%d", &c[d][e]);
			}
		}
		for (int d = 0; d < b; d++) {
			for (int e = 0; e < b; e++) {
				scanf("%d", &f[d][e]);
			}
		}
		for (int i = 0; i < 4; i++) {
			kaiten();
			for (int x = 0; x < a - b + 1; x++) {
				for (int y = 0; y < a - b + 1; y++) {
					bool S = true;
					for (int n = 0; n < b; n++) {
						for (int m = 0; m < b; m++) {
							if (f[n][m] != -1 && c[x+n][y+m] != f[n][m])S = false;
						}
					}
					if (S) {
						for (int n = 0; n < b; n++) {
							for (int m = 0; m < b; m++) {
								if (f[n][m] != -1) { V.push_back(P(x+n,y+m)); break; }
							}
						}
					}
				}
			}
		}
		if (V.size()) {
			sort(V.begin(), V.end(), [](P a, P b) {if (a.first != b.first)return a.first < b.first; return a.second <= b.second; });
			cout << V[0].second + 1 << " " << V[0].first + 1 << endl;
		}
		else {
			puts("NA");
		}
	}
}