#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second

int n, m;

int w[110][110];
int p[4][100][100];

int main(){
	while (cin >> n >> m&&n + m){
		REP(i, n){
			REP(j, n){
				cin >> w[i][j];
			}
		}
		REP(i, m){
			REP(j, m){
				cin >> p[0][i][j];
				p[1][j][m - 1 - i] = p[0][i][j];
				p[2][m - 1 - i][m - 1 - j] = p[0][i][j];
				p[3][m - 1 - j][i] = p[0][i][j];
			}
		}
		//REP(k, 4){
		//	REP(i, m){
		//		REP(j, m){
		//			cout << p[k][i][j] << "  ";
		//		}
		//		cout << endl;
		//	}
		//	cout << endl;
		//}
		vector<P> vp;
		REP(i, n - m + 1){
			REP(j, n - m + 1){
				REP(k, 4){
					bool f = 1;
					REP(l, m){
						REP(o, m){
							if (p[k][l][o] != -1 && p[k][l][o] != w[i + l][j + o]){
								f = 0;
							}
						}
					}
					if (f){
						bool g = 1;
						REP(l, m){
							REP(o, m){
								if (p[k][l][o] != -1){
									vp.push_back(P(i + l + 1, j + o + 1));
									g = 0;
								}
								if (!g)break;
							}
							if (!g)break;
						}
					}
				}
			}
		}
		if (vp.size() == 0){
			cout << "NA" << endl;
		}
		else{
			sort(ALL(vp));
			cout << vp[0].second << " " << vp[0].first << endl;
		}
	}
}