Module Module1

    Sub main()
        Dim user2 As List(Of String) = New List(Of String)(Split(Console.ReadLine(), " "))
        Dim toudaiMax As Long = user2(0)
        Dim michiMax As Long = user2(1)

        ' 展望台の高さを取得
        Dim user3 As List(Of String) = New List(Of String)(Split(Console.ReadLine(), " "))
        'Dim toudaiHeight As New List(Of Long)(user3.ToArray)

        Dim toudaiHeight As New List(Of Long)(Array.ConvertAll(user3.ToArray, Function(i As String) CLng(i)))

        Dim goodTenboFlg(toudaiMax - 1) As Boolean

        For i = 0 To goodTenboFlg.Count - 1
            goodTenboFlg(i) = True
        Next


        For i = 0 To michiMax - 1
            Dim user4 As List(Of String) = New List(Of String)(Split(Console.ReadLine(), " "))
            Dim michiA As Long = user4(0) - 1
            Dim michiB As Long = user4(1) - 1

            If toudaiHeight(michiA) >= toudaiHeight(michiB) Then
                goodTenboFlg(michiB) = False
                Console.WriteLine((michiB + 1).ToString & "は低い")
            End If
            If toudaiHeight(michiA) <= toudaiHeight(michiB) Then
                goodTenboFlg(michiA) = False
                Console.WriteLine((michiA + 1).ToString & "は低い")
            End If
        Next
        Dim sss As New List(Of Boolean)(goodTenboFlg)
        Console.WriteLine(sss.FindAll(Function(n) n).Count)
  end module