#include <iostream>
#include <vector>

using namespace std;

int scene[100][100], picture[50][50], temporary[50][50];

int main(){
	while(true){
		int n, m;
		cin >> n >> m;
		if(n == 0 && m == 0){ break; }
		for(int y = 0; y < n; ++y){
			for(int x = 0; x < n; ++x){ cin >> scene[y][x]; }
		}
		for(int y = 0; y < m; ++y){
			for(int x = 0; x < m; ++x){ cin >> picture[y][x]; }
		}
		bool found = false;
		int answerx = n, answery = n;
		for(int r = 0; r < 4; ++r){
			for(int y = n - m - 1; y >= 0; --y){
				for(int x = n - m - 1; x >= 0; --x){
					bool flag = true;
					int tx, ty;
					for(int py = m - 1; py >= 0 && flag; --py){
						for(int px = m - 1; px >= 0; --px){
							if(picture[py][px] >= 0){
								if(picture[py][px] != scene[y + py][x + px]){
									flag = false;
									break;
								}else{
									tx = x + px;
									ty = y + py;
								}
							}
						}
					}
					if(flag){
						found = true;
						if(ty < answery){
							answery = ty;
							answerx = tx;
						}else if(ty == answery){
							answerx = min(answerx, tx);
						}
					}
				}
			}
			for(int y = 0; y < m; ++y){
				for(int x = 0; x < m; ++x){ temporary[y][x] = picture[x][m - y - 1]; }
			}
			for(int y = 0; y < m; ++y){
				for(int x = 0; x < m; ++x){ picture[y][x] = temporary[y][x]; }
			}
		}
		if(found){
			cout << (answerx + 1) << " " << (answery + 1) << endl;
		}else{
			cout << "NA" << endl;
		}
	}
	return 0;
}