#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n, m;
        cin >> n >> m;
        if(n == 0)
            return 0;

        vector<vector<int> > a(n, vector<int>(n));
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                cin >> a[i][j];
            }
        }

        vector<vector<int> > b(m, vector<int>(m));
        for(int i=0; i<m; ++i){
            for(int j=0; j<m; ++j){
                cin >> b[i][j];
            }
        }

        int retY = -1;
        int retX = -1;

        for(int i=0; i<4; ++i){
            int dx = 0;
            while(b[0][dx] == -1)
                ++ dx;

            for(int y=0; y+m<=n; ++y){
                for(int x=0; x+m<=n; ++x){
                    bool ng = false;
                    for(int j=0; j<m; ++j){
                        for(int k=0; k<m; ++k){
                            if(b[j][k] != -1 && b[j][k] != a[y+j][x+k]){
                                ng = true;
                                break;
                            }
                        }
                        if(ng)
                            break;
                    }
                    if(!ng){
                        retY = y;
                        retX = x + dx;
                        break;
                    }
                    if(y == retY && x + dx == retX)
                        break;
                }
                if(y == retY)
                    break;
            }

            vector<vector<int> > c(m, vector<int>(m));
            for(int j=0; j<m; ++j){
                for(int k=0; k<m; ++k){
                    c[k][m-1-j] = b[j][k];
                }
            }
            b = c;
        }

        if(retY == -1)
            cout << "NA" << endl;
        else
            cout << (retX+1) << ' ' << (retY+1) << endl;
    }
}