Class Main
    Public Shared Sub Main()
    Dim NM() As string = Split(Console.ReadLine())
    dim N as integer = cint(NM(0))
    dim M as integer = cint(NM(1))
    dim HS() as string = Split(Console.ReadLine())
    dim H(N + 1) as integer
    dim S(N + 1) as string
    dim i1,i2 as integer
    for i1 = 0 to N - 1
    	H(i1 + 1) = cint(HS(i1))
	    S(i1+ 1) = ""
  	next i1
    for i1 = 1 to M    
	    Dim AB() As string = Split(Console.ReadLine())
	    dim A as integer = cint(AB(0))
    	dim B as integer = cint(AB(1))
  		if H(A) < H(B) then
    		S(A) = "1"
  		else
    		S(B) = "1"
  		end if
	next i1  
	i2 = 0
   for i1 = 1 to N
		if S(i1) = "" then
			i2 += 1
		end if
  	next i1
      Console.WriteLine(i2)
   End Sub
End Class
