#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

typedef pair<int,int> P;
typedef pair<bool,P> PP;
int field[200][200];
int pic[51][51];
int n,m;
const P NA = P(1000,1000);

void print(){
  for(int i = 0; i < m; i++){
    for(int j = 0; j < m; j++)
      cout << pic[i][j] << " ";
    cout << endl;
  }

  cout << endl;
}
void rotate(){
  int cop[m][m];

  for(int i = 0; i < m; i++)
    for(int j = 0; j < m; j++)
      cop[i][j] = pic[i][j];

  // print();

  for(int i = 0; i < m; i++)
    for(int j = 0; j < m; j++)
      pic[m-1-j][i] = cop[i][j];

  
  //print();
}

PP much(int x, int y){

  PP ret;
  ret.first = true;
  
  bool flg = true;
  for(int i = x,k = 0; i < x+m; i++,k++)
    for(int j = y,l = 0; j < y+m; j++,l++){
      if(!(field[i][j] == pic[k][l] || pic[k][l] == -1)) return PP(false,NA);
      if(flg && pic[k][l] != -1){
	flg = false;
	ret.second = P(j+1,i+1);
      }
    }


  return ret;
}

P solve(){
  P ans = NA;

  
  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++){
      PP pp = much(i,j);
      if(pp.first) ans = min(ans,pp.second);

    }

  return ans;
}

int main(){

  while(cin >> n >> m && n+m){
    memset(field,-1,sizeof(field));

    for(int i = 0; i < n; i++)
      for(int j = 0; j < n; j++)
	cin >> field[i][j];

    for(int i = 0; i < m; i++)
      for(int j = 0; j < m; j++)
	cin >> pic[i][j];

       
    P ans = solve();


     for(int i = 0; i < 3; i++){
      rotate();
      solve();
      ans = min(ans,solve());
     }

    if(ans != NA) cout << ans.first << " " << ans.second << endl;
    else cout << "NA" << endl;

  }
  return 0;
}