#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, m;
	while (cin >> m >> n) {
		if (n == 0 && m == 0) {
			break;
		}
		vector< vector<int> > data(m, vector<int>(m));
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < m; j++) {
				cin >> data[i][j];
			}
		}
		vector< vector<int> > d(n, vector<int>(n));
		vector< vector<int> > d2(n, vector<int>(n));
		vector< vector<int> > d3(n, vector<int>(n));
		vector< vector<int> > d4(n, vector<int>(n));
		int a;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> a;
				d[i][j] = a;
				d2[n-1-j][i] = a;
				d3[n-1-i][n-1-j] = a;
				d4[j][n-1-i] = a;
			}
		}/*
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cout << d[i][j] << ' ';
			}
			cout << endl;
		}
		cout << endl;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cout << d2[i][j] << ' ';
			}
			cout << endl;
		}
		cout << endl;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cout << d3[i][j] << ' ';
			}
			cout << endl;
		}
		cout << endl;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cout << d4[i][j] << ' ';
			}
			cout << endl;
		}
		cout << endl;*/
		int x, y;
		x = y = -1;
		for (int i = 0; i <= m-n; i++) {
			bool h2 = false;
			for (int j = 0; j <= m-n; j++) {
				bool h = true;
				int xx, yy;
				xx = yy = -1;
				for (int k = 0; k < n; k++) {
					for (int l = 0; l < n; l++) {
						if (d[k][l] == -1) {
						} else if (data[i+k][j+l] == d[k][l]) {
							if (xx == -1) {
								xx = j+l;
								yy = i+k;
							}
						} else {
							h = false;
							break;
						}
					}
					if (!h) {
						break;
					}
				}
				if (h) {
					//cout << 'a' << endl;
					x = xx;
					y = yy;
					h2 = true;
					break;
				}
			}
			if (h2) {
				break;
			}
		}
		for (int i = 0; i <= m-n; i++) {
			bool h2 = false;
			for (int j = 0; j <= m-n; j++) {
				bool h = true;
				int xx, yy;
				xx = yy = -1;
				for (int k = 0; k < n; k++) {
					for (int l = 0; l < n; l++) {
						if (d2[k][l] == -1) {
						} else if (data[i+k][j+l] == d2[k][l]) {
							if (xx == -1) {
								xx = j+l;
								yy = i+k;
							}
						} else {
							h = false;
							break;
						}
					}
					if (!h) {
						break;
					}
				}
				if (h) {
					//cout << 'b' << endl;
					if (x == -1 || yy < y) {
						x = xx;
						y = yy;
					} else if (yy == y && xx < x) {
						x = xx;
					}
					h2 = true;
					break;
				}
			}
			if (h2) {
				break;
			}
		}
		for (int i = 0; i <= m-n; i++) {
			bool h2 = false;
			for (int j = 0; j <= m-n; j++) {
				bool h = true;
				int xx, yy;
				xx = yy = -1;
				for (int k = 0; k < n; k++) {
					for (int l = 0; l < n; l++) {
						if (d3[k][l] == -1) {
						} else if (data[i+k][j+l] == d3[k][l]) {
							if (xx == -1) {
								xx = j+l;
								yy = i+k;
							}
						} else {
							h = false;
							break;
						}
					}
					if (!h) {
						break;
					}
				}
				if (h) {
					//cout << 'c' << endl;
					if (x == -1 || yy < y) {
						x = xx;
						y = yy;
					} else if (yy == y && xx < x) {
						x = xx;
					}
					h2 = true;
					break;
				}
			}
			if (h2) {
				break;
			}
		}
		for (int i = 0; i <= m-n; i++) {
			bool h2 = false;
			for (int j = 0; j <= m-n; j++) {
				bool h = true;
				int xx, yy;
				xx = yy = -1;
				for (int k = 0; k < n; k++) {
					for (int l = 0; l < n; l++) {
						if (d4[k][l] == -1) {
						} else if (data[i+k][j+l] == d4[k][l]) {
							if (xx == -1) {
								xx = j+l;
								yy = i+k;
							}
						} else {
							h = false;
							break;
						}
					}
					if (!h) {
						break;
					}
				}
				if (h) {
					//cout << 'd' << endl;
					if (x == -1 || yy < y) {
						x = xx;
						y = yy;
					} else if (yy == y && xx < x) {
						x = xx;
					}
					h2 = true;
					break;
				}
			}
			if (h2) {
				break;
			}
		}
		if (x == -1) {
			cout << "NA" << endl;
		} else {
			cout << x+1 << ' ' << y+1 << endl;
		}
	}
	return 0;
}