#include<iostream>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

vector< vector<int> > MakeMatrix(int);
multimap<int, int> SpinMatrix(vector< vector<int> >&);
void SearchPicture(vector< vector<int> >, vector< vector<int> >,
		   multimap<int, int>, int&, int&);
bool SearchPictureInner(vector< vector<int> >, vector< vector<int> >,
			multimap<int, int>, int, int);
int main(){
  int i, n, m, x, y;
  multimap<int, int> info;
  vector< vector<int> > data1, data2;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;

    data1 = MakeMatrix(n);
    data2 = MakeMatrix(m);
    x = data1.size() - data2.size() + 1;
    y = 0;

    for(i=0; i<4; ++i){
      info = SpinMatrix(data2);
      SearchPicture(data1, data2, info, x, y);
    }

    if(x == data1.size() - data2.size() + 1)
      cout << "NA" << endl;
    else
      cout << y+1 << " " << x+1 << endl;
  }
  return 0;
}

vector< vector<int> > MakeMatrix(int n){
  int i, j, x;
  vector<int> _data;
  vector< vector<int> > data;
  for(i=0; i<n; ++i){
    for(j=0; j<n; ++j){
      cin >> x;
      _data.push_back(x);
    }
    data.push_back(_data);
    _data.clear();
  }
  return data;
}

multimap<int, int> SpinMatrix(vector< vector<int> >& data){
  int i, j;
  vector<int> __data;
  vector< vector<int> > _data;
  multimap<int, int> map_data;

  for(i=0; i<data.size(); ++i) __data.push_back(0);
  for(i=0; i<data.size(); ++i) _data.push_back(__data);

  for(i=0; i<data.size(); ++i){
    for(j=0; j<data.size(); ++j){
      _data[i][j] = data[data.size()-1-j][i];
      if(_data[i][j] != -1) map_data.insert(make_pair(i, j));
    }
  }
  data = _data;
  return map_data;
}

void SearchPicture(vector< vector<int> > data1, vector< vector<int> > data2,
		   multimap<int, int> info, int& x, int& y){
  int i, j, n;
  if(x == data1.size() - data2.size() + 1) n = x-1;
  else n = x;

  for(i=0; i<=n; ++i){
    for(j=0; j<=n; ++j){
      if(SearchPictureInner(data1, data2, info, i, j)){
	if(i + info.begin()->first < x ||
	   (i + info.begin()->first == x && j + info.begin()->second < y)){
	  x = i + info.begin()->first;
	  y = j + info.begin()->second;
	}
	return;
      }
    }
  }
}

bool SearchPictureInner(vector< vector<int> > data1, vector< vector<int> > data2,
			multimap<int, int> info, int n, int m){
  multimap<int, int>::iterator i;
  for(i=info.begin(); i!=info.end(); ++i){
    if(data1[n + i->first][m + i->second] != data2[i->first][i->second])
      return false;
  }
  return true;
}