#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

struct Info{
	int div_row,div_col,num;
};

int N,M;

void func(){
	int scenely[N][N],picture[4][M][M];

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++)scanf("%d",&scenely[i][k]);
	}

	for(int i = 0; i < M; i++){
		for(int k = 0; k < M; k++)scanf("%d",&picture[0][i][k]);
	}

	//??????????????¢?????????
	//90
	for(int i = 0; i <= M-1; i++){
		for(int k=0; k <= M-1; k++){
			picture[1][k][M-1-i] = picture[0][i][k];
		}
	}

	//180
	for(int i=0; i <= M-1; i++){
		for(int k=0; k <= M-1;k++){
			picture[2][k][M-1-i] = picture[1][i][k];
		}
	}

	//270
	for(int i=0; i <= M-1; i++){
		for(int k=0; k <= M-1;k++){
			picture[3][k][M-1-i] = picture[2][i][k];
		}
	}

	Info data[4][M*M];
	int index[4] = {0,0,0,0};

	for(int i = 0; i < 4; i++){
		for(int row = 0; row < M; row++){
			for(int col = 0; col < M;col++){
				if(picture[i][row][col] != -1){
					data[i][index[i]].div_row = row;
					data[i][index[i]].div_col = col;
					data[i][index[i]].num = picture[i][row][col];
					index[i]++;
				}
			}
		}
	}

	int ans_row = -1,ans_col = -1;
	bool FLG = false;

	for(int i = 0; i <= N-M; i++){
		for(int k = 0; k <= N-M; k++){
			for(int a = 0; a < 4; a++){
				FLG = true;
				for(int b = 0; b < index[a];b++){
					if(scenely[i+data[a][b].div_row][k+data[a][b].div_col] != data[a][b].num){
						FLG = false;
						break;
					}
				}
				if(FLG){
					ans_row = i+data[a][0].div_row;
					ans_col = k+data[a][0].div_col;
					break;
				}
			}
			if(FLG)break;
		}
		if(FLG)break;
	}

	if(!FLG){
		printf("NA\n");
	}else{
		printf("%d %d\n",ans_col+1,ans_row+1);
	}
}


int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}