local n, m = io.read("*n", "*n")
local h = {}
local t = {}
for i = 1, n do
  h[i] = io.read("*n")
  t[i] = true
end
for i = 1, m do
  local a, b = io.read("*n", "*n")
  if h[a] < h[b] then
    t[a] = false
  elseif h[b] < h[a] then
    t[b] = false
  else
    t[a] = false
    t[b] = false
  end
end
c = 0
for i = 1, n do
  if t[i] then c = c + 1 end
end
print(c)
