import Data.List
import qualified Data.ByteString.Char8 as B

main = do
    n<-readLn::IO Int
    (t:a:_)<-map read.words<$>getLine::IO [Int]
    hs<-unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[Int]
    --
    print $ snd $ minimum $ zip (map (\x-> abs(t*1000 - x*1000*6 - a*1000)) hs) [1..]