import Data.Bifunctor (first)

main :: IO ()
main = do
    _ <- getLine
    [t, a] <- fmap read . words <$> getLine
    xs <- fmap read . words <$> getLine
    answer $ solve t a xs

type Answer = Int
answer :: Answer -> IO ()
answer = print

solve :: Int -> Int -> [Int] -> Answer
solve t a xs = snd $ minimum $ map (first $ \x -> abs ((a - t) * 1000 + x * 6)) $ zip xs [1..]