function main(input) {
  const args = input.split('\n')
  const n = Number(args[0].split(' ')[0])
  const m = Number(args[0].split(' ')[1])
  const tall = args[1].split(' ').map(v => Number(v))
  const data = args.slice(2, args.length)
  let good = Array(n).fill(true)
  let d = []
  for (let i = 0; i < m; i++) {
    d = data[i].split(' ').map(v => Number(v))
    if (tall[d[0] - 1] < tall[d[1] - 1]) {
      good[d[0] - 1] = false
    } else {
      good[d[1] - 1] = false
    }
    d = []
  }
  console.log(good.filter(v => v).length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))