import Control.Monad
import Data.List (sortBy)

manhattan [x1, y1] [x2, y2] =
  x + y
    where
      x = abs $ x1 - x2
      y = abs $ y1 - y2

solve [] ys = []
solve (x:xs) ys = (msolve (solve' x ys)) : solve xs ys

solve' x ys = zip [1..] $ fmap (\y -> manhattan x y) ys

msolve ts = fst $ head $ sortBy (\x y -> compare (snd x) (snd y)) ts

main = do
  [n, m] <- words <$> getLine
  ns <- replicateM (read n) $ words <$> getLine
  ms <- replicateM (read m) $ words <$> getLine
  let ns' = fmap (\xs -> fmap (read :: String -> Int) xs) ns
      ms' = fmap (\xs -> fmap (read :: String -> Int) xs) ms in
    forM_ (solve ns' ms') (\a -> putStrLn ((show :: Int -> String) a))
