Module AtCoder166
  
    Sub Main(args As String())

        Dim arr As String() = Split(Console.ReadLine())
        Dim tenboidai_Count As Integer = CInt(arr(0))
        Dim way_Count As Integer = CInt(arr(1))

        '展望台の高さリスト
        Dim tenboidai_height_List As List(Of Integer) = New List(Of Integer)()
        '展望台別の繋がっている展望台リストのディクショナリ
        Dim tenboidai_way_Dic As Dictionary(Of Integer, List(Of Integer)) = New Dictionary(Of Integer, List(Of Integer))()
        Dim arr_height As String() = Split(Console.ReadLine())
        For i As Integer = 1 To tenboidai_Count
            '標高代入
            tenboidai_height_List.Add(CInt(arr_height(i - 1)))
            '道ディクショナリ初期化
            tenboidai_way_Dic.Add(i, New List(Of Integer)())
        Next

        '繋がっている展望台の組合せ
        For j As Integer = 1 To way_Count
            Dim arr_way As String() = Split(Console.ReadLine())
            Dim pointA As Integer = CInt(arr_way(0))
            Dim pointB As Integer = CInt(arr_way(1))
            '道ディクショナリ代入
            Dim listA As List(Of Integer) = tenboidai_way_Dic(pointA)
            listA.Add(pointB)
            tenboidai_way_Dic(pointA) = listA
            Dim listB As List(Of Integer) = tenboidai_way_Dic(pointB)
            listB.Add(pointA)
            tenboidai_way_Dic(pointB) = listB
        Next

        'よい展望台判定
        Dim ret As Integer = 0
        For k As Integer = 1 To tenboidai_Count
            Dim way_list As List(Of Integer) = tenboidai_way_Dic(k)
            '道なし
            If way_list.Count = 0 Then
                ret = ret + 1
                Continue For
            End If
            '道あり
            Dim height_side As List(Of Integer) = New List(Of Integer)()
            For m As Integer = 1 To way_list.Count
                height_side.Add(tenboidai_height_List(way_list.Item(m - 1) - 1))
            Next
            Dim higtest As Integer = height_side.Max()
            If tenboidai_height_List.Item(k - 1) > higtest Then ret = ret + 1
        Next

        Console.WriteLine(ret.ToString())

    End Sub

End Module