import sys



readline = sys.stdin.readline

MOD = 10 ** 9 + 7

INF = float('INF')

sys.setrecursionlimit(10 ** 5)





def main():

    n, m = list(map(int, readline().split()))

    h = list(map(int, readline().split()))



    good = [True] * n



    for _ in range(m):

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

        a, b = a - 1, b - 1

        ha, hb = h[a], h[b]



        if ha <= hb:

            good[a] = False

        if ha >= hb:

            good[b] = False



    print((good.count(True)))



if __name__ == '__main__':

    main()

import sys



readline = sys.stdin.readline

MOD = 10 ** 9 + 7

INF = float('INF')

sys.setrecursionlimit(10 ** 5)





def main():

    import io, os

    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline



    n, m = list(map(int, input().decode().rstrip("\n\r").split()))

    h = list(map(int, input().decode().rstrip("\n\r").split()))



    is_good = [True] * n



    for _ in range(m):

        a, b = list(map(int, input().decode().rstrip("\n\r").split()))

        h_a, h_b = h[a - 1], h[b - 1]

        if h_a >= h_b:

            is_good[b - 1] = False

        if h_b >= h_a:

            is_good[a - 1] = False



    print((sum(is_good)))





if __name__ == '__main__':

    main()

import sys

readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)


def main():
    n, m = list(map(int, readline().split()))
    h = list(map(int, readline().split()))
    good = [True] * n
    for _ in range(m):
        a, b = list(map(int, readline().split()))
        a, b = a - 1, b - 1
        ha, hb = h[a], h[b]
        if ha <= hb:
            good[a] = False
        if ha >= hb:
            good[b] = False
    print((good.count(True)))


if __name__ == "__main__":
    main()

import sys

readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)


def main():
    import io, os

    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
    n, m = list(map(int, input().decode().rstrip("\n\r").split()))
    h = list(map(int, input().decode().rstrip("\n\r").split()))
    is_good = [True] * n
    for _ in range(m):
        a, b = list(map(int, input().decode().rstrip("\n\r").split()))
        h_a, h_b = h[a - 1], h[b - 1]
        if h_a >= h_b:
            is_good[b - 1] = False
        if h_b >= h_a:
            is_good[a - 1] = False
    print((sum(is_good)))


if __name__ == "__main__":
    main()

-    n, m = list(map(int, readline().split())) -    h = list(map(int, readline().split())) -    good = [True] * n +    import io, os + +    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline +    n, m = list(map(int, input().decode().rstrip("\n\r").split())) +    h = list(map(int, input().decode().rstrip("\n\r").split())) +    is_good = [True] * n -        a, b = list(map(int, readline().split())) -        a, b = a - 1, b - 1 -        ha, hb = h[a], h[b] -        if ha <= hb: -            good[a] = False -        if ha >= hb: -            good[b] = False -    print((good.count(True))) +        a, b = list(map(int, input().decode().rstrip("\n\r").split())) +        h_a, h_b = h[a - 1], h[b - 1] +        if h_a >= h_b: +            is_good[b - 1] = False +        if h_b >= h_a: +            is_good[a - 1] = False +    print((sum(is_good)))