#include<iostream>
#include<algorithm>
#include<cstdio>

struct P{
	int x, y;
};

int main(){
	const int MAX_N = 100, MAX_M = 50;
	int image_a[MAX_N][MAX_N], image_b[4][MAX_M][MAX_M];
	int n, m;
	P most_lt[4];
	
	while(std::cin >> n >> m, n){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				std::cin >> image_a[i][j];
			}
		}

		for(int i=0;i<4;i++){
			most_lt[i].x = -1;
			most_lt[i].y = -1;
		}

		for(int i=0;i<m;i++){
			for(int j=0;j<m;j++){
				std::cin >> image_b[0][i][j];
				if(image_b[0][i][j] != -1 && most_lt[0].x == -1){
					most_lt[0].x = j;
					most_lt[0].y = i;
				}
			}
		}

		//回転したものをつくる
		for(int i=1;i<4;i++){
			for(int y=0;y<m;y++){
				for(int x=0;x<m;x++){
					image_b[i][y][x] = image_b[i-1][x][m-y-1];
					if(image_b[i][y][x] != -1 && most_lt[i].x == -1){
						most_lt[i].x = x;
						most_lt[i].y = y;
					}
				}
			}
		}

		int res_x = -1, res_y = -1, res_i = -1;
		for(int y=0;y<n&&res_x==-1;y++){
			for(int x=0;x<n&&res_x==-1;x++){

				for(int i=0;i<4&&res_x==-1;i++){
					if(image_b[i][0][0] == -1 || image_a[y][x] == image_b[i][0][0]){
						bool f = true;
						for(int j=0;j<m&&f;j++){
							for(int k=0;k<m;k++){
								if(image_b[i][j][k] == -1 || image_b[i][j][k] == image_a[y+j][x+k]){

								}else{
									f = false;
									break;
								}
							}
						}
						
						if(f){
							res_x = x;
							res_y = y;
							res_i = i;
						}
					}
				}

			}
		}

		if(res_x == -1){
			puts("NA");
		}else{
			printf("%d %d\n", res_x+most_lt[res_i].x+1, res_y+most_lt[res_i].y+1);
		}
	}
}