#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j,k,l;
  int a[100][100],b[50][50],m,n;

  while(cin>>n>>m&&n+m){
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
	cin>>a[j][i];
    for(i=0;i<m;i++)
      for(j=0;j<m;j++)
	cin>>b[j][i];
    for(i=0;i<n-m+1;i++){
      for(j=0;j<n-m+1;j++){
	for(k=0;k<m;k++){
	  for(l=0;l<m;l++){
	    if(b[l][k]!=-1&&
	       b[l][k]!=a[j+l][i+k])
	      break;
	  }
	  if(l!=m)
	    break;
	}
	if(k==m){
	  for(k=0;b[k][0]==-1;k++);
	  cout<<j+k+1<<" "<<i+1<<endl;;
	  break;
	}
	for(k=0;k<m;k++){
	  for(l=0;l<m;l++){
	    if(b[m-k-1][l]!=-1&&
	       b[m-k-1][l]!=a[j+l][i+k])
	      break;
	  }
	  if(l!=m)
	    break;
	}
	if(k==m){
	  for(k=0;b[m-1][k]==-1;k++);
	  cout<<j+k+1<<" "<<i+1<<endl;
	  break;
	}
	for(k=0;k<m;k++){
	  for(l=0;l<m;l++){
	    if(b[m-l-1][m-k-1]!=-1&&
	       b[m-l-1][m-k-1]!=a[j+l][i+k])
	      break;
	  }
	  if(l!=m)
	    break;
	}
	if(k==m){
	  for(k=0;b[m-k-1][m-1]==-1;k++);
	  cout<<j+k+1<<" "<<i+1<<endl;
	  break;
	}
	for(k=0;k<m;k++){
	  for(l=0;l<m;l++){
	    if(b[k][m-l-1]!=-1&&
	       b[k][m-l-1]!=a[j+l][i+k])
	      break;
	  }
	  if(l!=m)
	    break;
	}
	if(k==m){
	  for(k=0;b[0][m-k-1]==-1;k++);
	  cout<<j+k+1<<" "<<i+1<<endl;
	  break;
	}
      }
      if(j!=n-m+1)
	break;
    }
    if(i==n-m+1)
      cout<<"NA"<<endl;
  }
  return 0;
}