#include <cstdio>
#include <vector>

using namespace std;

typedef struct Pixel {
	Pixel(int _x, int _y, int _val){ x = _x; y = _y; val = _val; }
	int x, y, val;
} Pixel;

typedef struct Picture {
	int x;
	vector<Pixel> pixels;
} Picture;

Picture pictures[4];
int scene[100][100];

int main(){
	while(true){
		int n, m;
		scanf("%d%d", &n, &m);
		if(n == 0 || m == 0){ break; }
		for(int i = 0; i < 4; i++){
			pictures[i].x = m;
			pictures[i].pixels.clear();
		}
		for(int y = 0; y < n; y++){
			for(int x = 0; x < n; x++){
				scanf("%d", &(scene[x][y]));
			}
		}
		for(int y = 0; y < m; y++){
			for(int x = 0; x < m; x++){
				int val;
				scanf("%d", &val);
				if(val < 0){ continue; }
				pictures[0].pixels.push_back(Pixel(x, y, val));
				if(y == 0 && x < pictures[0].x){ pictures[0].x = x; }
				pictures[1].pixels.push_back(Pixel(y, m - x - 1, val));
				if(m - x  == 1 && y < pictures[1].x){ pictures[1].x = y; }
				pictures[2].pixels.push_back(Pixel(m - x - 1, m - y - 1, val));
				if(m - y == 1 && m - x - 1 < pictures[2].x){ pictures[2].x = m - x - 1; }
				pictures[3].pixels.push_back(Pixel(m - y - 1, x, val));
				if(x == 0 && m - y - 1 < pictures[3].x){ pictures[3].x = m - y - 1; }
			}
		}
		int ansX = -1, ansY = -1;
		for(int y = 0; y < (n - m); y++){
			for(int x = 0; x < (n - m); x++){
				for(int i = 0; i < 4; i++){
					vector<Pixel>::iterator it = pictures[i].pixels.begin();
					while(it != pictures[i].pixels.end()){
						if((*it).val != scene[x + (*it).x][y + (*it).y]){
							break;
						}
						it++;
					}
					if(it == pictures[i].pixels.end()){
						if(ansX < 0 || x + pictures[i].x < ansX){
							ansX = x + pictures[i].x;
							ansY = y;
						}
					}
				}
			}
			if(ansX >= 0){ break; }
		}
		if(ansX < 0 || ansY < 0){
			printf("NA\n");
		}else{
			printf("%d %d\n", ansX + 1, ansY + 1);
		}
	}
	return 0;
}