#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define LT(a,b,c,d) (((a)<(c))||((a)==(c)&&(b)<(d)))
#define INF 114514


int view[100][100];
int pict[50][50];
int supX,supP;
int mendoP,mendoQ;
int resX,resY;


bool rotPict(){
	int buf[50][50];
	FOR(p,0,supP) FOR(q,0,supP) buf[p][q] = pict[supP-1-q][p];
	FOR(p,0,supP) FOR(q,0,supP) pict[p][q] = buf[p][q];
}

bool findMendo(){
	FOR(p,0,supP) FOR(q,0,supP) if(pict[p][q]!=-1){ mendoP=p; mendoQ=q; return true; }
	return false;
}

bool match(int offX, int offY){
	FOR(p,0,supP) FOR(q,0,supP) if(pict[p][q]!=-1 && pict[p][q]!=view[offX+p][offY+q]) return false;
	return true;
}

bool letMatch(){
	FOR(offX,0,supX-supP+1) FOR(offY,0,supX-supP+1){
		if(match(offX,offY)){
			if(LT(offX+mendoP, offY+mendoQ, resX, resY)){
				resX = offX+mendoP;
				resY = offY+mendoQ;
			}
			return true;
		}
	}
}

int main(){
	while(true){
		cin >> supX >> supP;			if(!supX&&!supP) return 0;

		FOR(x,0,supX) FOR(y,0,supX) cin >> view[x][y];
		//FOR(x,0,supX) {FOR(y,0,supX) cout << view[x][y] << " "; cout << endl;}

		FOR(p,0,supP) FOR(q,0,supP) cin >> pict[p][q];

		resX=INF; resY=INF;
		REP(i,4){
			//cout << endl;
			//FOR(p,0,supP) {FOR(q,0,supP) cout << pict[p][q] << " "; cout << endl;}
			findMendo();
			letMatch();
			rotPict();
		}

		if(resX==INF&&resY==INF){cout << "NA" << endl;}
		else{cout << resY+1 << " " << resX+1 << endl;}

	}
}