import           Control.Monad
import           Data.Array
import qualified Data.IntSet   as S

readInts :: IO [Int]
readInts = map read . words <$> getLine

readPair :: IO (Int, Int)
readPair = (\[x, y] -> (x, y)) <$> readInts

main :: IO ()
main = do
  (n, m) <- readPair
  hs <- listArray (1, n) <$> readInts
  abs <- replicateM m readPair
  print $ solve n hs abs

solve :: Int -> Array Int Int -> [(Int, Int)] -> Int
solve n hs abs = S.size $ foldr f (S.fromList [1..n]) abs
  where
    f (a, b) st = case compare (hs!a) (hs!b) of
      LT -> S.delete a st
      EQ -> S.delete a $ S.delete b st
      GT -> S.delete b st