#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

typedef pair<int,int> pii;

int n, m;

int main() {
	while(cin >> n >> m, n || m) {
		vector<vector<int> > pic, sce;
		for(int i = 0; i < n; i++) {
			vector<int> v;
			for(int j = 0; j < n; j++) {
				int tmp;
				cin >> tmp;
				v.push_back(tmp);
			}
			pic.push_back(v);
		}
		for(int i = 0; i < m; i++) {
			vector<int> v;
			for(int j = 0; j < m; j++) {
				int tmp;
				cin >> tmp;
				v.push_back(tmp);
			}
			sce.push_back(v);
		}

		vector<pii> ans;
		for(int d = 0; d < 4; d++) {
			for(int i = 0; i < n - m + 1; i++) {
				for(int j = 0; j < n - m + 1; j++) {
					pii p;
					for(int k = 0; k < m; k++) {
						for(int l = 0; l < m; l++) {
							if(pic[i+k][j+l] != sce[k][l] && sce[k][l] != -1)
								goto LABEL;
						}
					}

					for(int k = 0; k < m; k++) {
						for(int l = 0; l < m; l++) {
							if(sce[k][l] != -1) {
								p.first = k + i;
								p.second = l + j;
								k = l = m;
							}
						}
					}
					ans.push_back(p);
					/*
					for(int i = 0; i < n; i++) {
						for(int j = 0; j < n; j++)
							cout << pic[i][j] << " ";
						cout << endl;
					}
					for(int i = 0; i < m; i++) {
						for(int j = 0; j < m; j++)
							cout << sce[i][j] << " ";
						cout << endl;
					}
					*/
LABEL:;
				}
			}

			vector<vector<int> > nex;
			for(int i = 0; i < m; i++) {
				nex.push_back(vector<int>());
				for(int j = 0; j < m; j++) {
					nex[i].push_back(sce[m-1-j][i]);
				}
			}
			sce = nex;
		}
		sort(ans.begin(), ans.end());

		if(ans.size()) {
			cout << ans[0].second + 1 << " " << ans[0].first + 1 << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
}