program ABC166_C
  integer,allocatable::H(:),A(:),B(:),c(:)
  read(*,*)N,M
  allocate(H(N),A(M),B(M),c(N))
  c=1
  read(*,*)H
  do i=1,M
     read(*,*)A(i),B(i)
     if(H(A(i))>=H(B(i))) c(B(i))=0
     if(H(A(i))<=H(B(i))) c(A(i))=0
  end do
  write(*,*)sum(c)
end program ABC166_C