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 long
    dim i1,i2 as integer
    for i1 = 0 to N - 1
    	H(i1 + 1) = clng(HS(i1))
  	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
    		HS(A - 1) = ""
  elseif H(A) > H(B) then
    		HS(B - 1) = ""
  else
    		HS(A - 1) = ""
    		HS(B - 1) = ""
  		end if
	next i1  
	i2 = 0
for i1 = 0 to N - 1
		if HS(i1) <> "" then
			i2 += 1
		end if
  	next i1
      Console.WriteLine(i2)
   End Sub
End Class
