#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
vector< vector<int> > rot( vector< vector<int> > &ary){
  int n = (int)ary.size();
  vector< vector<int> > ret(n,vector<int>(n));
  REP(y,n)REP(x,n)ret[y][x]=ary[n-1-x][y];
  return ret;
} 
int main(void){
  int m1,m2;
  while(cin>>m1>>m2){
    if(m1==0) break;
    vector< vector<int> > view(m1,vector<int>(m1));
    REP(y,m1)REP(x,m1) cin>>view[y][x];
    vector< vector<int> > pict(m2,vector<int>(m2));
    REP(y,m2)REP(x,m2) cin>>pict[y][x];
    vector<PII> ans;
    REP(k,4){
      for(int sy=0; sy+m2-1<m1; sy++){
        for(int sx=0; sx+m2-1<m1; sx++){
          bool f = true;
          REP(dy,m2)REP(dx,m2){
            if(pict[dy][dx]!=-1 && pict[dy][dx]!=view[sy+dy][sx+dx]){
              f=false;
              goto READ;
            }
          }
          READ:
          if(f){
            REP(y,m2)REP(x,m2){
              if(pict[y][x]!=-1){
                ans.push_back(PII(sy+y,sx+x));
                goto END;
              }
            }
          }
          END:;
        }
      }
      pict = rot(pict);
    }
    if(ans.empty()){
      cout<<"NA"<<endl;
    }else{
      sort(ans.begin(),ans.end());
      printf("%d %d\n",ans[0].second+1,ans[0].first+1);
    } 
  }
  return 0;
}