import Control.Monad
import Data.Maybe
import Data.List

getLineToIntList = map read . words <$> getLine :: IO[Int]

minimumIndex :: [Int] -> Int
minimumIndex a = (fromJust $ elemIndex (minimum a) a) + 1

main = do
 [n,m] <- getLineToIntList 
 abList <- replicateM n getLineToIntList 
 cdList <- replicateM m getLineToIntList
 forM_ [0..(n-1)] $ \i -> do
  print $ minimumIndex $ map (sum . zipWith (\x y -> abs(x - y)) (abList !! i)) (cdList)