#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,m;
  while(cin>>n>>m,n){
    vector<pair<int,int> >v;
    int a[n][n],b[4][m][m];
    r(i,n)r(j,n)cin>>a[i][j];
    r(i,m)r(j,m)cin>>b[0][i][j];
    r(i,m)r(j,m)b[1][i][j]=b[0][j][m-i-1];
    r(i,m)r(j,m)b[2][i][j]=b[0][m-1-j][i];
    r(i,m)r(j,m)b[3][i][j]=b[0][m-1-i][m-1-j];
    r(i,n-m+1)r(j,n-m+1)r(k,4){
      int c=0;
      r(q,m)r(w,m)if(b[k][q][w]>=0)
       if(a[i+q][j+w]!=b[k][q][w])c++;
      if(!c)r(q,m)r(w,m)if(b[k][q][w]>=0)
        v.push_back(make_pair(q+i,w+j));
    }if(!v.size())cout<<"NA"<<endl;
    else{
      sort(v.begin(),v.end());
      cout<<v[0].second+1<<' '<<v[0].first+1<<endl;
    }
  }
}