
var t = "6 5\n" +
        "8 6 9 1 2 1\n" +
        "1 3\n" +
        "4 2\n" +
        "4 3\n" +
        "4 6\n" +
        "4 6"

fun main(args: Array<String>) {

    read = stdin

    val (N, M) = readInts()
    val H = readInts()
    val (A, B) = readInts2(M)

    val flags = Array(N){true}

    for(i in 0 until M){
        A[i]--
        B[i]--
        if(H[A[i]] > H[B[i]]){
            flags[B[i]] = false
        }else if(H[A[i]] == H[B[i]]){
            flags[A[i]] = false
            flags[B[i]] = false
        }else{
            flags[A[i]] = false
        }
    }

    var cnt = 0
    for(flag in flags) {
        if(flag) cnt++
    }
    println(cnt)
}


fun answer(args: Array<String>){
    println("ほげ")
}



// #######################################################
//  入力用
// #######################################################

var ts = t.split("\n")
var c = 0
var debug = {ts[c++]}
var stdin = {readLine()!!}
var read = stdin

fun readInt(): Int{
    return read().toInt()
}

fun readInts(): Array<Int>{
    return read().split(" ").map(String::toInt).toTypedArray()
}

fun readInts2(n: Int) : Pair<Array<Int>, Array<Int>>{
    val a = Array(n){0}
    val b = Array(n){0}
    for(i in 0 until n){
        val r = readInts()
        a[i] = r[0]
        b[i] = r[1]
    }
    return Pair(a, b)
}

