import Data.Int (Int64)
import Data.List
import Data.Function

main :: IO ()
main = do
    _ <- getLine
    [t,a] <- map read . words <$> getLine :: IO [Int64]
    h <- map read . words <$> getLine :: IO [Int64]
    print . snd . minimumBy (compare `on` fst)
          $ zip [ abs (a * 1000 - t - x * 6) | x <- h ] [1..]
