#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
const int INF = INT_MAX / 2;

typedef long long ll;

int N, M;
int fld[2][100][100];

bool IsOutside(int x, int y)
{
	return x < 0 || N <= x || y < 0 || N <= y;
}

void RotateField()
{
	int fld_c[100][100];
	for(int i = 0; i < M; i++)
	{
		for(int j = 0; j < M; j++)
		{
			fld_c[M - 1 - j][i] = fld[1][i][j];
		}
	}
	for(int i = 0; i < M; i++)
	{
		for(int j = 0; j < M; j++)
		{
			fld[1][i][j] = fld_c[i][j];
		}
	}
}

bool IsAgreement(int x0, int y0, int &x1, int &y1)
{
	x1 = -1;
	for(int i = 0; i < M; i++)
	{
		for(int j = 0; j < M; j++)
		{
			if(fld[1][i][j] == -1) continue;
			if(IsOutside(x0 + j, y0 + i) || fld[0][y0 + i][x0 + j] != fld[1][i][j]) return false;
			if(x1 == -1)
			{
				x1 = x0 + j; y1 = y0 + i;
			}
		}
	}
	return true;
}

int main(){
	while(cin >> N >> M, N || M)
	{
		for(int i = 0; i < N; i++)
		{
			for(int j = 0; j < N; j++)
			{
				cin >> fld[0][i][j];
			}
		}
		for(int i = 0; i < M; i++)
		{
			for(int j = 0; j < M; j++)
			{
				cin >> fld[1][i][j];
			}
		}

		int x, y;
		int ax = -1, ay;
		for(int i = 0; i < 4; i++)
		{
			/*puts("");
			for(int j = 0; j < M; j++)
			{
				for(int k = 0; k < M; k++)
				{
					if(fld[1][j][k] == -1) printf(" O");
					else printf(" X");
				}puts("");
			}puts("");*/

			for(int j = -M; j < N; j++)
			{
				for(int k = -M; k < N; k++)
				{
					if(!IsAgreement(k, j, x, y)) continue;
					if(ax == -1 || ay > y || (ay == y && ax > x)) ax = x, ay = y;
				}
			}
			RotateField();
		}

		if(ax == -1) puts("NA");
		else printf("\t%d %d\n", ++ax, ++ay);
	}
	return 0;
}