n,m=io.read("*n","*n","*l")
h={}
t={}
for i=1,n do
    h[i]=io.read("*n")
    t[i]=0
end
for i=1,m do
    a,b=io.read("*n","*n")
    if h[a]>h[b] then
        t[a]=1
        t[b]=0
    else
        t[a]=0
        t[b]=1
    end
end

counter=0
for i=1,n do
    counter=counter+t[i]
end
print(counter)