"use strict";

const input = require("fs").readFileSync("/dev/stdin", "utf8");
const rows = input.trim().split("\n");

const header = rows.shift().split(" ").map(Number);
const N = header[0];
const M = header[1];

const HList = rows.shift().split(" ");
const HMap = {};
HList.forEach((H, index) => {
  HMap[index + 1] = Number(H);
});

const falseMap = {};
rows.forEach((row) => {
  const pair = row.split(" ").map(Number);
  const A = pair[0];
  const B = pair[1];
  const HA = HMap[A];
  const HB = HMap[B];
  if (HA < HB) {
    falseMap[A] = true;
  } else if (HA > HB) {
    falseMap[B] = true;
  } else if (HA === HB) {
    falseMap[A] = true;
    falseMap[B] = true;
  }
});

const result = N - Object.keys(falseMap).length;
console.log(result);
