## import



## function definition 



## main process

if __name__ == '__main__':

    

    ## input

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

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

    ROAD_LIST = []

    for j in range(M): 

        ROAD_LIST.append(

            tuple(map(int,input().split()))

        )

    

    ## business logic

    ans = [1] * N

    for j in list(range(M)):

        point_a = ROAD_LIST[j][0]

        point_b = ROAD_LIST[j][1]



        point_a -= 1

        point_b -= 1



        height_a = HEIGHT_LIST[point_a]

        height_b = HEIGHT_LIST[point_b]



        if height_a < height_b:

            ans[point_a] = 0

        elif height_a > height_b:

            ans[point_b] = 0

        else:

            ans[point_a] = 0

            ans[point_b] = 0



    ## output

    print((sum(ans)))
## import



## function definition 



## main process

if __name__ == '__main__':

    

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

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

    

    ans = [1] * N

    for j in range(M):

        a, b = list(map(int,input().split()))

        a -= 1

        b -= 1

        height_a = HEIGHT_LIST[a]

        height_b = HEIGHT_LIST[b]



        if height_a < height_b:

            ans[a] = 0

        elif height_a > height_b:

            ans[b] = 0

        else:

            ans[a] = 0

            ans[b] = 0



    print((sum(ans)))
## import
## function definition
## main process
if __name__ == "__main__":
    ## input
    N, M = list(map(int, input().split()))
    HEIGHT_LIST = list(map(int, input().split()))
    ROAD_LIST = []
    for j in range(M):
        ROAD_LIST.append(tuple(map(int, input().split())))
    ## business logic
    ans = [1] * N
    for j in list(range(M)):
        point_a = ROAD_LIST[j][0]
        point_b = ROAD_LIST[j][1]
        point_a -= 1
        point_b -= 1
        height_a = HEIGHT_LIST[point_a]
        height_b = HEIGHT_LIST[point_b]
        if height_a < height_b:
            ans[point_a] = 0
        elif height_a > height_b:
            ans[point_b] = 0
        else:
            ans[point_a] = 0
            ans[point_b] = 0
    ## output
    print((sum(ans)))

## import
## function definition
## main process
if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    HEIGHT_LIST = list(map(int, input().split()))
    ans = [1] * N
    for j in range(M):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        height_a = HEIGHT_LIST[a]
        height_b = HEIGHT_LIST[b]
        if height_a < height_b:
            ans[a] = 0
        elif height_a > height_b:
            ans[b] = 0
        else:
            ans[a] = 0
            ans[b] = 0
    print((sum(ans)))

-    ## input -    ROAD_LIST = [] +    ans = [1] * N -        ROAD_LIST.append(tuple(map(int, input().split()))) -    ## business logic -    ans = [1] * N -    for j in list(range(M)): -        point_a = ROAD_LIST[j][0] -        point_b = ROAD_LIST[j][1] -        point_a -= 1 -        point_b -= 1 -        height_a = HEIGHT_LIST[point_a] -        height_b = HEIGHT_LIST[point_b] +        a, b = list(map(int, input().split())) +        a -= 1 +        b -= 1 +        height_a = HEIGHT_LIST[a] +        height_b = HEIGHT_LIST[b] -            ans[point_a] = 0 +            ans[a] = 0 -            ans[point_b] = 0 +            ans[b] = 0 -            ans[point_a] = 0 -            ans[point_b] = 0 -    ## output +            ans[a] = 0 +            ans[b] = 0