Option Explicit On

Module Module1

    Sub Main()

        Dim tmp As String() = Split(Console.ReadLine(), " ")
        Dim N As Integer = CInt(tmp(0))
        Dim M As Integer = CInt(tmp(1))
        Dim ans As Integer = N

        Dim H(N - 1) As Integer
        Dim yoi(N - 1) As Boolean
        Dim tmp2 As String() = Split(Console.ReadLine(), " ")
        For i As Integer = 0 To N - 1
            H(i) = CInt(tmp2(i))
            yoi(i) = True
        Next

        Dim a(M - 1) As Integer
        Dim b(M - 1) As Integer
        Dim r(M - 1) As Integer
        For i As Integer = 0 To M - 1
            Dim tmp3 As String() = Split(Console.ReadLine(), " ")
            a(i) = CInt(tmp3(0))
            b(i) = CInt(tmp3(1))
            If H(a(i) - 1) < H(b(i) - 1) Then
                If yoi(a(i) - 1) = True Then
                    ans -= 1
                    yoi(a(i) - 1) = False
                End If
            Else
                If yoi(b(i) - 1) = True Then
                    ans -= 1
                    yoi(b(i) - 1) = False
                End If
            End If
        Next

        Console.WriteLine(ans)

    End Sub

End Module
