#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0 ,n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;


signed main(){
    int n, m;
    while(1){
        cin >> n >> m;
        if(n + m == 0) break;
        int a[101][101] = {0};
        int d[4][51][51] = {0};
        REP(i, n){
            REP(j, n){
                cin >> a[i][j];
            }
        }
        REP(i, m){
            REP(j, m){
                cin >> d[0][i][j];
            }
        }
        rep(k, 1, 4){
            REP(i, m){
                REP(j, m){
                    d[k][i][j] = d[k - 1][j][m - 1 - i];
                }
            }
        }
        // rep(k, 0 ,4){
        //     rep(i, 0, m){
        //         rep(j, 0, m){
        //             cout << d[k][i][j] << ' ';
        //         }
        //         cout << endl;
        //     }
        //     cout << endl;
        // }
        vector<pair<int, int> > ans;
        int x = -1, y = -1;
        REP(i, n) REP(j, n){
            REP(k, 4){
                bool f = false;
                REP(p, m) REP(q, m){
                    if(!(d[k][p][q] == a[i + p][j + q] || d[k][p][q] == -1)){
                        p = m; q = m; break;
                    }
                    if(!f && d[k][p][q] == a[i + p][j + q]){
                        f = true; y = i + p + 1; x = j + q + 1;
                    }
                    if(p == m - 1 && q == m - 1){
                        ans. push_back(make_pair(y, x));
                    }
                }
            }
        }
        sort(all(ans));
        if(ans.size() == 0) cout << "NA" << endl;
        else cout << ans[0]. second << ' ' << ans[0]. first << endl;
    }
}