#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int photo[100][100];
int pict[50][50];

int n, m;

void rot() {
  int tmp[50][50];
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      tmp[i][j] = pict[i][j];
    }
  }

  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      //printf("%d", tmp[m - j -1][i]);
      pict[i][j] = tmp[m - j - 1][i];
    }
    //printf("\n");
  }
}

bool ans(int I, int J)
{
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      if (pict[i][j] != -1 && photo[I + i][J + j] != pict[i][j]) {return false;}
    }
  }
  return true;
}

void printans(int I, int J)
{
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      if (pict[i][j] != -1) {
	printf("%d %d\n", j + J + 1, i + I + 1);
	return;
      }
    }
  }
}

int main()
{
  while (scanf("%d %d ", &n, &m) == 2) {
    if (n == 0 && m == 0) {
      break;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	scanf("%d ", &photo[i][j]);
      }
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
	scanf("%d ", &pict[i][j]);
      }
    }
    
    /*    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	printf("%d", photo[i][j]);
      }
      printf("\n");
      }*/
    /*    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
	printf("%d", pict[i][j]);
      }
      printf("\n");
    }
    rot();
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
	printf("%d", pict[i][j]);
      }
      printf("\n");
      }*/
    
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	if (i + m - 1 >= n && j + m - 1 >= n) {continue;}
	for (int k = 0; k < 4; k++) {
	  if (ans(i, j)) {
	    printans(i, j);
	    goto next;
	  }
	  rot();
	}
      }
    }
    printf("NA\n");
  next:;
  }
}