import Control.Monad
import Data.Maybe
import Data.Array
import Data.List
import Text.Printf
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as C

getInts :: IO [Int]
getInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n, m] <- getInts
  hs <- getInts
  es <- replicateM m getInts
  let update v (Just vs) = Just (v : vs)
      graph = foldl' (\mp [u, v] -> M.alter (update u) v $ M.alter (update v) u mp) (M.fromList $ zip [1..n] $ repeat [])  es
      as = array (1, n) $ zip [1 .. n] hs
      ans = M.foldlWithKey' (\c u vs -> if all (< as ! u) (map (as !) vs) then c + 1 else c) (0 :: Int) graph
  printf "%d\n" ans
