var count:[Int] = []
var count2:[Int] = []
var count3:[Int] = []
let arr=readLine()!.split{$0==" "}.map{Int(String($0))!}
var n=arr[0]
var k=arr[1]
let arr2=readLine()!.split{$0==" "}.map{Int(String($0))!}
for i in 1...n {
    count3.append(i)
}
for _ in 1...k {
   let j=readLine()!.split{$0==" "}.map{Int(String($0))!}
    let a=j[0]
    let b=j[1]

    if arr2[a-1]<arr2[b-1]{
        count.append(b)
    }else{
        count.append(a)
    }
    count2.append(a)
    count2.append(b)
}
let result = count.reduce([], { $0.contains($1) ? $0 : $0 + [$1] })
let result2 = count2.reduce([], { $0.contains($1) ? $0 : $0 + [$1] })

print(result.count+(count3.count-result2.count))
