using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("UnitTestProject1")] 
namespace AOJ
{
    public  class Program
    {

        private static bool isMatch(string x, string y)
        {
            if (y == "-1")
            {
                return true;
            }
            return x.Equals(y);
        }

        private static int[] rotate(int n,int x, int y, int d)
        {
            switch (d)
            {
                case 0:
                    return new int[] { x, y };
                    
                case 90:
                    return new int[] { y, n-1-x };
                    
                case 180:
                    return new int[] { n-1-x, n-1-y };

                default:
                    return new int[]{n-1-y,x};

            }
        }

        //private static bool
        private static string solve(int n,int m)
        {
            string[][] tbl = new string[n][];

            for (int i = 0; i < n; i++)
            {
                tbl[i] = Console.ReadLine().Split(new char[] { ' ' });
            }
            
            //切れ端
            string[][] subTbl = new string[m][];

            for (int i = 0; i < m; i++)
            {
                subTbl[i] = Console.ReadLine().Split(new char[] { ' ' });
            }

            int[] r = { 0, 90, 180, 270 };
            for (int i = 0; i <= n - m; i++)
            {
                for (int j = 0; j <= n - m; j++)
                {//比較スタート地点
                 
                    for (int hoge = 0; hoge < 4; hoge++)
                    {
                        bool flg = true;
                        int rsltX=-1,rsltY = -1;
                        for (int mi = 0; mi < m; mi++)
                        {
                            for (int mj = 0; mj < m; mj++)
                            {

                                int[] piyo = rotate(m, mi, mj, r[hoge]);
                                //Console.WriteLine(piyo[0] + " " + piyo[1]);
                                if (!isMatch(tbl[i + mi][j + mj], subTbl[piyo[0]][piyo[1]]))
                                {
                                    flg = false;
                                    break;
                                }
                                else if(rsltX == -1)
                                {
                                    if (subTbl[piyo[0]][piyo[1]] != "-1")
                                    {
                                        rsltX = i + mi+1;
                                        rsltY = j + mj+1;
                                    }
                                }
                            }
                            if (!flg) break;
                        }

                        if (flg)
                        {
                            return  rsltY.ToString() + " " + rsltX.ToString();
                        }
                    }

                    //for (int hoge = 0; hoge < 2; hoge++)
                    //{
                    //    bool flg = true;
                    //    for (int mi = 0; mi < m; mi++)
                    //    {
                    //        for (int mj = 0; mj < m; mj++)
                    //        {

                    //            int mx = ((x2[hoge] < 0) ? m - 1 : 0) + mi * x2[hoge];
                    //            int my = ((y2[hoge] < 0) ? m - 1 : 0) + mj * y2[hoge];
                    //            Console.WriteLine(my.ToString() + " " + mx.ToString());
                    //            if (!isMatch(tbl[i + mi][j + mj], subTbl[my][mx]))
                    //            {
                    //                flg = false;
                    //                break;
                    //            }
                    //        }
                    //        if (!flg) break;
                    //    }

                    //    if (flg)
                    //    {
                    //        return i.ToString() + j.ToString();
                    //    }
                    //}
                }
            }
            return "NA";
        }

        static void Main(string[] args)
        {

            while (true)
            {
                string[] hoge = Console.ReadLine().Split(new char[] { ' ' });
                int n = int.Parse(hoge[0]);
                int m = int.Parse(hoge[1]);
                if (n == 0 && m== 0) break;
                Console.WriteLine(solve(n,m));
            }
        }
    }
}

Measured memory_bytes: 7060