import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector.Unboxed as VU

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,m] <- getIntList
    hs <- VU.fromList <$> getIntList
    abs <- VU.replicateM m $ do
        [a,b] <- getIntList
        return (a-1,b-1)
    let neighbors = V.create $ do
            vec <- VM.replicate n []
            VU.forM_ abs $ \(a,b) -> do
                VM.modify vec (b:) a
                VM.modify vec (a:) b
            return vec
        counts = map (\i -> all (< hs VU.! i) $ map (hs VU.!) (neighbors V.! i)) [0..n-1]
    print . length $ filter id counts