function main(input) {
  const inputs = input.trim().split('\n')
  const [N, M] = inputs[0].split(' ')
  const H = [0, ...inputs[1].split(' ')].map(Number)
  const path = []
  inputs.slice(2).forEach(e => {
    // console.log('e', e)
    const [A, B] = e.split(' ')
    if (!path[A]) {
      path[A] = []
    }
    path[A].push(B)
    if (!path[B]) {
      path[B] = []
    }
    path[B].push(A)
  })
  // console.log(path)

  let good = 0
  for(let i = 1; i <= N; i++) {
    let isGood = true
    if (!path[i]) {
      good++
      continue
    }
    for(const e of path[i]) {
      // console.log(i, H[i], e, H[e])
      if (H[e] >= H[i]) {
        isGood = false
        // console.log('not good')
        break
      }
    }
    if (isGood) good++
  }
  console.log(good)
}

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