{-# LANGUAGE MultiWayIf #-}
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Array
import Data.Array.IO

main = do
  [n,m] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  hs <- map (read . BS.unpack) . BS.words <$> BS.getLine
  let hArr = listArray (1,n) hs :: Array Int Int
  arr <- newArray (1,n) True :: IO (IOUArray Int Bool) 
  abs <- replicateM m $ do
    [a,b] <- map (read . BS.unpack) . BS.words <$> BS.getLine
    if | hArr ! a < hArr ! b -> writeArray arr a False
       | hArr ! a > hArr ! b -> writeArray arr b False
       | otherwise           -> writeArray arr a False >> writeArray arr b False
  print <=< fmap sum . forM [1..n] $ \t -> do
    f <- readArray arr t
    pure $ if f then 1 else 0 :: Int