#include<iostream>
#include<cassert>
#include<ctime>
#include<climits>
#include<queue>
#include<fstream>
#include<deque>
#include<iomanip>
#include<list>
#include<stack>
#include<sstream>
#include<string>
#include<cctype>
#include<cstdio>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<set>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
#define F first
#define S second
#define all(n) n.begin(),n.end()
#define pb push_back
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define INF (1<<27)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
int n,m;
int nmap[102][102],map_0[52][52];
int map_90[52][52],map_180[52][52],map_270[52][52];

void make_map(){
  //cout << "90---" << endl;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      map_90[i][j] = map_0[j][(m-1)-i];
      //cout << map_90[i][j] << " ";
    }
    //cout << endl;
  }
  //cout << endl;

  //cout << "180---" << endl;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      map_180[i][j] = map_0[(m-1)-i][(m-1)-j];
      //cout << map_180[i][j] << " ";
    }
    //cout << endl;
  }
  //cout << endl;

  //cout << "270---" << endl;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      map_270[i][j] = map_0[(m-1)-j][i];
      //cout << map_270[i][j] << " ";
    }
    //cout << endl;
  }
  //cout << endl;

 

}


bool research(int x,int y,int dir){
  assert(0<= dir && dir < 4);
  //cout << "res! x = "<< x << ",y = " << y << ",dir = " << dir << endl;  
  int ansx,ansy;
  bool first = true;
  ansx = ansy = INT_MAX;
  rep(i,m){
    rep(j,m){
      if((map_0[i][j] == -1 && dir == 0) || (dir == 1 &&map_90[i][j] == -1) ||( dir == 2 && map_180[i][j] == -1) ||(dir == 3 && map_270[i][j] == -1))continue;      
      //cout << nmap[y+i][x+i] << " ";
      //if(!(0<= x+j && x+j <m && 0<= y+i && y+i < m))return false;
      if(dir == 0){
	if(nmap[y+i][x+j] != map_0[i][j] && nmap[y+i][x+j] != -1)return false;
	else if(first){
	  ansx = x+j,ansy = y+i;
	  first = !first;
	}
      }
      else if(dir == 1){
	if(nmap[y+i-(m-1)][x+j] != map_90[i][j] && nmap[y+i-(m-1)][x+j] != -1)return false;
	else if(first){
	  ansx = x+j,ansy = y+i-(m-1);
	  first = false;
	}
      }
      else if(dir == 2){
	if(nmap[y+i-(m-1)][x+j-(m-1)] != map_180[i][j] && nmap[y+i-(m-1)][x+j-(m-1)] != -1)return false;
	else if(first){
	  ansx = x+j-(m-1),ansy = y+i-(m-1);
	  first = false;
	}
      }
      else if(dir == 3){
	if(nmap[y+i][x+j-(m-1)] != map_270[i][j] && nmap[y+i][x+j-(m-1)] !=-1)return false;
	else if(first){
	  ansx = x+j-(m-1),ansy = y+i;
	  first = false;
	}
      }
      else assert(false);
    }
    //cout << endl;
  }

  cout << ansx+1 << " " << ansy+1 << endl;

 

  return true;
}


int main(){
  //int x,y;
  //x = 2,y = 5;
  //x = 1,y =1; 
  //int newx = x*cos(90/180.0*M_PI) - y*sin(90/180.0*M_PI);
  //int newy = x*sin(90/180.0*M_PI) + y*cos(90/180.0*M_PI); 
  // cout << newx+1 << " " << newy+4 << endl;

  while(true){
    cin >> n >> m;
    if(n+m == 0)break;
    rep(i,n){
      rep(j,n){
	cin >> nmap[i][j];
      }
    }

    //cout << "0---" << endl;
    rep(i,m){
      rep(j,m){
	cin >> map_0[i][j];
	//cout << map_0[i][j] << " ";
      }
      //cout << endl;
    }
    //cout << endl;

    make_map();


    bool fin = false;
    rep(i,n){
      rep(j,n){
	if(nmap[i][j] != map_0[0][0])continue;
	//cout << "x = " << j << ",y = " << i << endl;
	rep(k,4){
	  if(research(j,i,k)){
	   
	    //cout << j+1 << " " << i+1 << endl;
	    fin = true;
	    break;
	  }
	  
	  //cout << endl;
	  //cout << endl;
	}
	if(fin)break;
      }
      if(fin)break;
    }

    if(!fin)cout << "NA" << endl;

  }
return 0;
}