def g;gets.split.map &:to_i;end
def r c;c.map{|i|i.reverse}.transpose;end
while(n,m=g)[0]>0
v=(1..n).map{g}
c=(1..m).map{g}
t=[c,s=r(c),u=r(s),r(u)]
w=[*0..n-m]
d=[*0..m-1]
e=d.product d
a,b=w.product(w).find{|i,j|n=t.find{|f|e.all?{|y,x|f[x][y]<0||v[j+x][i+y]==f[x][y]}}}
puts a ?[a+1+n[0].index{|i|i>=0},b+1]*" ":"NA"
end