#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int a[110][110],b[4][16][16],n,m;
int main(){
	while(cin>>n>>m&&n+m){
		lol(i,n)lol(j,n)cin>>a[i][j];
		lol(i,m)lol(j,m){
			int x;cin>>x;
			b[0][i][j]=x;
			b[1][m-1-j][i]=x;
			b[2][m-1-i][m-1-j]=x;
			b[3][j][m-1-i]=x;
		}
		int y=0,x=0;
		while(true){
			x=0;
			while(true){
				lol(k,4){
					bool ok=true;
					lol(i,m)lol(j,m){
						if(a[y+i][x+j]!=b[k][i][j]&&b[k][i][j]!=-1)ok=false;
					}
					if(ok){
						lol(i,m)lol(j,m)if(b[k][i][j]!=-1){
							y+=i,x+=j;
							goto loop;
						}
					}
				}
				x++;
				if(x==n-m)break;
			}
			y++;
			if(y==n-m)break;
		}
		loop:;
		if(y==n-m)cout<<"NA"<<endl;
		else cout<<x+1<<" "<<y+1<<endl;
	}
	return 0;
}