const Main = (input) => {
    const lines = input.split('\n')
    line0=lines[0].trim().split(" ")
    N=parseInt(line0[0])
    K=lines[1]
    height=lines[1].trim().split(" ")
    result=new Array(N)
    for (j=0;j<result.length;j++){
        result[j]=true
    }
    for( i=2;i<lines.length;i++){
        line=lines[i].trim().split(" ").map(n=>parseInt(n))
        A=line[0]
        B=line[1]
        if(height[A-1]>height[B-1]){
            result[B-1]=false
        } else if(height[B-1]>height[A-1]){
            result[A-1]=false
        }else {
            result[B-1]=false
            result[A-1]=false
        }
    }
    let ans=0
    for (j=0;j<result.length;j++){
        if(result[j]){
            ans++
        }
    }
    console.log(ans)

}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))