# import numpy as np

# import queue

# import heapq







def main():

    N, M = list(map(int, input().split()))

    heights = list(map(int, input().split()))

    towers = [True for _ in range(N)]



    pathes = (list(map(int, input().split())) for _ in range(M))



    for path in pathes:



        a = path[0] - 1

        b = path[1] - 1



        ha = heights[a]

        hb = heights[b]



        if ha > hb:

            towers[b] = False

        elif ha < hb:

            towers[a] = False

        else:

            towers[a] = False

            towers[b] = False



    print((sum(towers)))





if __name__ == "__main__":

    main()

import sys

input = sys.stdin.readline





def main():

    n_obss, n_roads = list(map(int, input().split()))

    elevations = list(map(int, input().split()))



    is_good_obs = [True for _ in range(n_obss)]



    roads = (list(map(int, input().split())) for _ in range(n_roads))



    for road in roads:

        

        idx_a = road[0] - 1

        idx_b = road[1] - 1



        e_a = elevations[idx_a]

        e_b = elevations[idx_b]



        if e_a > e_b:

            is_good_obs[idx_b] = False

        elif e_a < e_b:

            is_good_obs[idx_a] = False

        else:

            is_good_obs[idx_a] = False

            is_good_obs[idx_b] = False



    print((sum(is_good_obs)))





if __name__ == "__main__":

    main()

# import numpy as np
# import queue
# import heapq
def main():
    N, M = list(map(int, input().split()))
    heights = list(map(int, input().split()))
    towers = [True for _ in range(N)]
    pathes = (list(map(int, input().split())) for _ in range(M))
    for path in pathes:
        a = path[0] - 1
        b = path[1] - 1
        ha = heights[a]
        hb = heights[b]
        if ha > hb:
            towers[b] = False
        elif ha < hb:
            towers[a] = False
        else:
            towers[a] = False
            towers[b] = False
    print((sum(towers)))


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline


def main():
    n_obss, n_roads = list(map(int, input().split()))
    elevations = list(map(int, input().split()))
    is_good_obs = [True for _ in range(n_obss)]
    roads = (list(map(int, input().split())) for _ in range(n_roads))
    for road in roads:
        idx_a = road[0] - 1
        idx_b = road[1] - 1
        e_a = elevations[idx_a]
        e_b = elevations[idx_b]
        if e_a > e_b:
            is_good_obs[idx_b] = False
        elif e_a < e_b:
            is_good_obs[idx_a] = False
        else:
            is_good_obs[idx_a] = False
            is_good_obs[idx_b] = False
    print((sum(is_good_obs)))


if __name__ == "__main__":
    main()

-# import numpy as np -# import queue -# import heapq +import sys + +input = sys.stdin.readline + + -    N, M = list(map(int, input().split())) -    heights = list(map(int, input().split())) -    towers = [True for _ in range(N)] -    pathes = (list(map(int, input().split())) for _ in range(M)) -    for path in pathes: -        a = path[0] - 1 -        b = path[1] - 1 -        ha = heights[a] -        hb = heights[b] -        if ha > hb: -            towers[b] = False -        elif ha < hb: -            towers[a] = False +    n_obss, n_roads = list(map(int, input().split())) +    elevations = list(map(int, input().split())) +    is_good_obs = [True for _ in range(n_obss)] +    roads = (list(map(int, input().split())) for _ in range(n_roads)) +    for road in roads: +        idx_a = road[0] - 1 +        idx_b = road[1] - 1 +        e_a = elevations[idx_a] +        e_b = elevations[idx_b] +        if e_a > e_b: +            is_good_obs[idx_b] = False +        elif e_a < e_b: +            is_good_obs[idx_a] = False -            towers[a] = False -            towers[b] = False -    print((sum(towers))) +            is_good_obs[idx_a] = False +            is_good_obs[idx_b] = False +    print((sum(is_good_obs)))