program main
  implicit none
  integer :: N, M
  integer,allocatable :: H(:), A(:), B(:)
  type neig
     integer, allocatable :: cand(:)
  end type neig
  type(neig), allocatable :: obs(:)
  integer, allocatable :: cnt(:)
  logical, allocatable :: flag(:)
  integer :: i,j,k


  read(*,*) N,M
  allocate(H(N),A(M),B(M))
  allocate(obs(N))
  allocate(cnt(N))
  read(*,*) H(:)
  do i = 1,M
     read(*,*) A(i),B(i)
  end do

  cnt(:) = 0
  do i = 1,M
     cnt(A(i)) = cnt(A(i)) + 1
     cnt(B(i)) = cnt(B(i)) + 1
  end do
  do i = 1,N
     allocate( obs(i)%cand(cnt(i)) )
  end do
  cnt(:) = 0
  do i = 1,M
     cnt(A(i)) = cnt(A(i)) + 1
     obs(A(i))%cand(cnt(A(i))) = B(i)
     cnt(B(i)) = cnt(B(i)) + 1
     obs(B(i))%cand(cnt(B(i))) = A(i)
  end do
  allocate(flag(N)) 
  flag(:) = .true.
  do i = 1,N
     do j = 1,cnt(i)
        if ( H(i) <= H( obs(i)%cand(j) ) ) then
           flag(i) = .false.
           exit
        end if
     end do
  end do
  write(*,'(i0)') count(flag)
  stop
end program main
