#include<bits/stdc++.h>
using namespace std;

typedef pair< int , int > Pi;
const int INF = 1 << 30;

int main(){
  int n, m;
  int mas[100][100];
  int ser[4][50][50];
  Pi point[4];


  while(cin >> n >> m, n){
    for(int i = 0; i < 4; i++){
      point[i] = Pi( INF, INF);
    }

    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
        cin >> mas[i][j];
      }
    }
    for(int i = 0; i < m; i++){
      for(int j = 0; j < m; j++){
        cin >> ser[0][i][j];
        if(ser[0][i][j] != -1) point[0] = min( point[0], Pi( i, j));
      }
    }
    for(int k = 0; k < 3; k++){
      for(int i = 0; i < m; i++){
        for(int j = 0; j < m; j++){
          ser[k + 1][j][m - i - 1] = ser[k][i][j];
          if(ser[k + 1][j][m - i - 1] != -1){
            point[k + 1] = min( point[k + 1], Pi( j, m - i - 1));
          }
        }
      }
    }

    Pi p = Pi( INF, INF);
    for(int i = 0; i + m <= n; i++){
      for(int j = 0; j + m <= n; j++){
        for(int q = 0; q < 4; q++){
          bool flag = true;
          for(int l = 0; l < m; l++){
            for(int o = 0; o < m; o++){
              if(ser[q][l][o] != -1 && mas[i + l][j + o] != ser[q][l][o]) flag = false;
            }
          }
          if(flag) p = min( p, Pi( i, j + point[q].second));
        }
      }
    }
    if(p == Pi( INF, INF)) cout << "NA" << endl;
    else cout << p.second + 1 << " " << p.first + 1 << endl;
  }
}