#include <iostream>

using namespace std;

const int INF = 100000000;

int n, m;
short pic1[100][100];
short pic2[50][50];
int ax, ay;

bool check(int y, int x){
  bool f;
  f = true;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      if(pic2[i][j] == -1) continue;
      if(pic1[y+i][x+j] != pic2[i][j]){
	i = INF;
	f = false;
	break;
      }
      if(ax == -1){
	ax = x+j+1;
	ay = y+i+1;
      }
    }
  }
  if(f) return true;
  f = true;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      if(pic2[j][m-1-i] == -1) continue;
      if(pic1[y+i][x+j] != pic2[j][m-1-i]){
	i = INF;
	f = false;
	break;
      }
      if(ax == -1){
	ax = x+j+1;
	ay = y+i+1;
      }
    }
  }
  if(f) return true;
  f = true;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      if(pic2[m-1-i][m-1-j] == -1) continue;
      if(pic1[y+i][x+j] != pic2[m-1-i][m-1-j]){
	i = INF;
	f = false;
	break;
      }
      if(ax == -1){
	ax = x+j+1;
	ay = y+i+1;
      }
    }
  }
  if(f) return true;
  for(int i=0;i<m;i++){
    for(int j=0;j<m;j++){
      if(pic2[m-1-j][i] == -1) continue;
      if(pic1[y+i][x+j] != pic2[m-1-j][i]){
	i = INF;
	f = false;
	break;
      }
      if(ax == -1){
	ax = x+j+1;
	ay = y+i+1;
      }
    }
  }
  return f;
}

main(){
  while(cin >> n >> m && (n || m)){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	cin >> pic1[i][j];
      }
    }
    for(int i=0;i<m;i++){
      for(int j=0;j<m;j++){
	cin >> pic2[i][j];
      }
    }
    ax = -1;
    for(int i=0;i<=n+m;i++){
      for(int j=0;j<=n+m;j++){
	if(check(i, j)){
	  i = INF;
	  break;
	}else{
	  ax = -1;
	}
      }
    }
    if(ax == -1){
      cout << "NA" << endl;
    }else{
      cout << ax << ' ' << ay << endl;
    }
  }
  return 0;
}