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