#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>

using namespace std;

int n, m;
int a[100][100], b[50][50];

void rotate()
{
  int c[50][50];

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

  copy(&c[0][0], &c[m][0], &b[0][0]);
}

string conv(int n)
{
  stringstream ss;
  ss << n;

  return ss.str();
}

string solve()
{
  bool f;

  for(int cs = 0; cs < 4; ++cs){
    for(int i = 0; i < n-m+1; ++i)
      for(int j = 0; j < n-m+1; ++j){
	f = true;
	for(int s = 0; f && s < m; ++s)
	  for(int t = 0; f && t < m; ++t){
	    if(a[i+s][j+t] == b[s][t] || b[s][t] == -1) continue;
	    f = false;
	  }

	if(f)
	  for(int s = 0; s < m; ++s)
	    for(int t = 0; t < m; ++t)
	      if(b[s][t] != -1) return (conv(j+t+1)+" "+conv(i+s+1));
      }

    rotate();
  }

  return "NA";
}

int main()
{
  while(cin>>n>>m && n+m){
    for(int i = 0; i < n; ++i)
      for(int j = 0; j < n; ++j) cin >> a[i][j];

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

    cout << solve() << endl;
  }

  return 0;
}