def rotate(picture)
  m = picture.size
  result = Array.new(m) {Array.new(m)}
  for i in 0...m do
    for j in 0...m do
      result[i][j] = picture[j][m-1-i]
    end
  end
  result
end

def check(scene, picture)
  n = scene.size
  m = picture.size
  result = nil
  2.times do
    for i in 0...n-m do
      for j in 0...n-m do
        ok = true
        top = nil
        for y in 0...m do
          for x in 0...m do
            next if picture[y][x] == -1
            ok = false if scene[i+y][j+x] != picture[y][x]
            top = [i+y+1, j+x+1] if (!top) && (picture[y][x] != -1)
          end
        end
        result = top if ok
        break if result
      end
      break if result
    end
    break if result
    picture = rotate(picture)
  end
  result
end

while true do
  n, m = gets.split.map(&:to_i)
  break if n|m == 0
  scene = []
  picture = []
  n.times {scene.push(gets.split.map(&:to_i))}
  m.times {picture.push(gets.split.map(&:to_i))}

  ans = check(scene, picture)
  puts (ans ? "#{ans[1]} #{ans[0]}" : "NA")
end