#!/usr/local/gnu/bin/bash
read n m
read -a h
h=(0 `echo ${h[@]}`)
p=(`echo ${h[@]} | tr [1-9] 0`)
r=$n
for i in `seq $m`
do
    read a b
    if((h[a]<=h[b]&&p[a]==0))
    then
        r=$((r-1))
        p[$a]=1
    fi
    if((h[a]>=h[b]&&p[b]==0))
    then
        r=$((r-1))
        p[$b]=1
    fi
done
echo $r
