#include<iostream>

using namespace std;

int window[100][100], picture[100][100], picture_90[100][100], picture_18\
0[100][100], picture_270[100][100], n, m;

int Map[100][100];

void solve(){
  int i, j, k, l, restPart=0, restPart_90=0, restPart_180=0, restPart_270\
=0, x0=0, y0=0, x90=0, y90=0, x180=0, y180=0, x270=0, y270=0, flag;
  flag=0;
  while(1){
    x0=0;
    while(1){
      if(picture[y0][x0]>=0){
        flag += 1;
      }
      if(flag>0)break;
      if(x0>=m-1)break;
      x0+=1;
    }
    if(flag>0)break;
    if(y0>=m-1)break;
    y0+=1;
  }
  flag=0;
  while(1){
    x90 = 0;
    while(1){
      if(picture_90[y90][x90]>=0){
        flag += 1;
      }
      if(flag>0)break;
      if(x90>=m-1)break;
      x90+=1;
    }
    if(flag>0)break;
    if(y90>=m-1)break;
    y90+=1;
  }
  flag=0;
  while(1){
    x180 = 0;
    while(1){
      if(picture_180[y180][x180]>=0){
        flag += 1;
      }
      if(flag>0)break;
      if(x180>=m-1)break;
      x180+=1;
    }
    if(flag>0)break;
    if(y180>=m-1)break;
    y180+=1;
  }
  flag =0;
  while(1){
    x270=0;
    while(1){
      if(picture_270[y270][x270]>=0){
        flag += 1;
      }
      if(flag>0)break;
      if(x270>=m-1)break;
      x270+=1;
    }
    if(flag>0)break;
    if(y270>=m-1)break;
    y270+=1;
  }
  for(i=0; i<m; i++){
    for(j=0; j<m; j++){
      if(picture[i][j]!=-1){
        restPart+=1;
      }
      if(picture_90[i][j]!=-1){
        restPart_90+=1;
      }
      if(picture_180[i][j]!=-1){
        restPart_180+=1;
      }
      if(picture_270[i][j]!=-1){
        restPart_270+=1;
      }
    }
  }

  int cout0, cout90, cout180, cout270;
  for(i=0; i<n-m+1; i++){
    for(j=0; j<n-m+1; j++){
      cout0 = 0, cout90 = 0, cout180 = 0, cout270 = 0;
      for(k=0; k<m; k++){
        for(l=0; l<m; l++){
          if(picture[k][l]==window[i+k][j+l]){
            cout0+=1;
          }
          if(picture_90[k][l]==window[i+k][j+l]){
            cout90+=1;
          }
          if(picture_180[k][l]==window[i+k][j+l]){
            cout180+=1;
          }
          if(picture_270[k][l]==window[i+k][j+l]){
            cout270+=1;
          }
        }
      }

      if(cout0==restPart){
        Map[i+y0][j+x0]=1;
      }
      if(cout90==restPart_90){
        Map[i+y90][j+x90]=1;
      }
      if(cout180==restPart_180){
        Map[i+y180][j+x180]=1;
      }
      if(cout270==restPart_270){
        Map[i+y270][j+x270]=1;
      }
    }
  }
}
int main(){
  int i, j;
  while(cin >> n >> m, n+m){
    for(i=0; i<100; i++){
      for(j=0; j<100; j++){
        window[i][j] = 0;
        picture[i][j] = 0;
        picture_90[i][j] = 0;
        picture_180[i][j] = 0;
        picture_270[i][j] = 0;
        Map[i][j] = 0;
      }
    }
    for(i=0; i<n; i++){
      for(j=0; j<n; j++){
        cin >> window[i][j];
      }
    }
    for(i=0; i<m; i++){
      for(j=0; j<m; j++){
        cin >> picture[i][j];
        picture_90[j][m-i-1] = picture[i][j];
        picture_180[m-i-1][m-j-1] = picture[i][j];
        picture_270[m-j-1][i] = picture[i][j];
      }
    }
    solve();

    int flag2=0, x=0, y=0;
    while(1){
      x=0;
      while(1){
        if(Map[y][x]==1){
          flag2 += 1;
        }
        if(flag2>0)break;
        if(x>=n-1)break;
        x+=1;
      }
      if(flag2>0)break;
      if(y>=n-1)break;
      y+=1;
    }
    if(flag2==0){
      cout << "NA" << endl;
    }else{
      cout << x+1 << " " << y+1 << endl;
    }
  }
}

Measured memory_bytes: 3296