import Control.Monad
import Data.List

main = do
  [n,m] <- map read . words <$> getLine
  hs <- map read . words <$> getLine
  abs <- replicateM m $ do
    [a,b] <- map read . words <$> getLine
    pure (a,b)
  print . length $ f [1..n] (0:hs) abs
 
 
f :: [Int] -> [Int] -> [(Int,Int)] -> [Int] 
f ns _ [] = ns
f ns hs ((a,b):abs)
  | hs !! a > hs !! b = f (ns \\ [b])   hs abs
  | hs !! a < hs !! b = f (ns \\ [a])   hs abs
  | otherwise         = f (ns \\ [a,b]) hs abs