'use strict'

function main(input) {
  const inputList = input.split('\n');
  const n = Number(inputList[0].split(' ')[0])
  const m = Number(inputList[0].split(' ')[1])
  const heightList = inputList[1].split(' ').map(height => Number(height))
  const routeList = inputList.slice(2)

  let goodTowers = new Array(n)
  goodTowers.fill(1)
  for (let i=0; i<routeList.length; i++) {
    const tmpTower = routeList[i].split(' ')
    const a = Number(tmpTower[0]) - 1 
    const b = Number(tmpTower[1]) - 1

    if (heightList[a] < heightList[b]) {
      goodTowers[a] = 0
    } else if (heightList[a] > heightList[b]) {
      goodTowers[b] = 0
    } else {
      goodTowers[a] = 0
      goodTowers[b] = 0
    }
  }

  let count = 0;
  for (let i=0; i<goodTowers.length; i++) {
    count += goodTowers[i]
  }
  console.log(count)

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));