import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import Data.Tuple (swap)

main :: IO ()
main = do
  [n, m] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  hs <- VU.fromList . map unsafeTextToInt . T.words <$> T.getLine :: IO (VU.Vector Int)
  abs <- sequence . replicate m $ unsafeListToPair . map (pred . unsafeTextToInt) . T.words <$> T.getLine :: IO [(Int, Int)]
  let
    adjacency = fromEdgesToAdjacencyVectorN n . concatMap (pairToList . ((,) <$> id <*> swap)) $ abs :: V.Vector [Int]
    p :: Int -> Bool
    p i = all (< hs VU.! i) . map (hs VU.!) $ adjacency V.! i
  print . length . filter p $ [0..(pred n)]

fromEdgesToAdjacencyVectorN :: Int -> [(Int, Int)] -> V.Vector [Int]
fromEdgesToAdjacencyVectorN n = V.accum (flip (:)) (V.replicate n [])

pairToList :: (a, a) -> [a]
pairToList (x, y) = [x, y]

unsafeListToPair :: [Int] -> (Int, Int)
unsafeListToPair [x, y] = (x, y)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
