def main():

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

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



    ab_dict = dict()  # 展望台i : [展望台iに隣接する展望台の標高]

    for _ in range(m):

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



        if a not in ab_dict:

            ab_dict[a] = [h_lst[b - 1]]

        else:

            ab_dict[a].append(h_lst[b - 1])



        if b not in ab_dict:

            ab_dict[b] = [h_lst[a - 1]]

        else:

            ab_dict[b].append(h_lst[a - 1])



    cnt = 0

    ab_dict_keys = list(ab_dict.keys())

    for i in range(1, n + 1):

        if i not in ab_dict_keys:

            cnt += 1

            continue

        if h_lst[i - 1] > max(ab_dict[i]):

            cnt += 1



    print(cnt)





if __name__ == "__main__":

    main()

def main():

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

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

    ok_lst = [1 for _ in range(n)]



    for _ in range(m):

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

        a -= 1

        b -= 1

        if h_lst[a] <= h_lst[b]:

            ok_lst[a] = 0

        if h_lst[b] <= h_lst[a]:

            ok_lst[b] = 0



    ans = sum(ok_lst)

    print(ans)





if __name__ == "__main__":

    main()

def main():
    n, m = list(map(int, input().split()))
    h_lst = list(map(int, input().split()))
    ab_dict = dict()  # 展望台i : [展望台iに隣接する展望台の標高]
    for _ in range(m):
        a, b = list(map(int, input().split()))
        if a not in ab_dict:
            ab_dict[a] = [h_lst[b - 1]]
        else:
            ab_dict[a].append(h_lst[b - 1])
        if b not in ab_dict:
            ab_dict[b] = [h_lst[a - 1]]
        else:
            ab_dict[b].append(h_lst[a - 1])
    cnt = 0
    ab_dict_keys = list(ab_dict.keys())
    for i in range(1, n + 1):
        if i not in ab_dict_keys:
            cnt += 1
            continue
        if h_lst[i - 1] > max(ab_dict[i]):
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

def main():
    n, m = list(map(int, input().split()))
    h_lst = list(map(int, input().split()))
    ok_lst = [1 for _ in range(n)]
    for _ in range(m):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        if h_lst[a] <= h_lst[b]:
            ok_lst[a] = 0
        if h_lst[b] <= h_lst[a]:
            ok_lst[b] = 0
    ans = sum(ok_lst)
    print(ans)


if __name__ == "__main__":
    main()

-    ab_dict = dict()  # 展望台i : [展望台iに隣接する展望台の標高] +    ok_lst = [1 for _ in range(n)] -        if a not in ab_dict: -            ab_dict[a] = [h_lst[b - 1]] -        else: -            ab_dict[a].append(h_lst[b - 1]) -        if b not in ab_dict: -            ab_dict[b] = [h_lst[a - 1]] -        else: -            ab_dict[b].append(h_lst[a - 1]) -    cnt = 0 -    ab_dict_keys = list(ab_dict.keys()) -    for i in range(1, n + 1): -        if i not in ab_dict_keys: -            cnt += 1 -            continue -        if h_lst[i - 1] > max(ab_dict[i]): -            cnt += 1 -    print(cnt) +        a -= 1 +        b -= 1 +        if h_lst[a] <= h_lst[b]: +            ok_lst[a] = 0 +        if h_lst[b] <= h_lst[a]: +            ok_lst[b] = 0 +    ans = sum(ok_lst) +    print(ans)