def main():

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

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

    hAns = [1] * n

    for i in range(m):

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

        if hList[a - 1] > hList[b - 1]:

            hAns[b - 1] = 0

            continue

        if hList[a - 1] < hList[b - 1]:

            hAns[a - 1] = 0

            continue

        hAns[a - 1] = 0

        hAns[b - 1] = 0

    print((sum(hAns)))





if __name__ == '__main__':

    main()

import sys

readline = sys.stdin.readline





def main():

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

    hList = list(map(int, readline().rstrip().split()))

    hAns = [1] * n

    for i in range(m):

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

        if hList[a - 1] > hList[b - 1]:

            hAns[b - 1] = 0

            continue

        if hList[a - 1] < hList[b - 1]:

            hAns[a - 1] = 0

            continue

        hAns[a - 1] = 0

        hAns[b - 1] = 0

    print((sum(hAns)))





if __name__ == '__main__':

    main()

def main():
    n, m = list(map(int, input().split()))
    hList = list(map(int, input().split()))
    hAns = [1] * n
    for i in range(m):
        a, b = list(map(int, input().split()))
        if hList[a - 1] > hList[b - 1]:
            hAns[b - 1] = 0
            continue
        if hList[a - 1] < hList[b - 1]:
            hAns[a - 1] = 0
            continue
        hAns[a - 1] = 0
        hAns[b - 1] = 0
    print((sum(hAns)))


if __name__ == "__main__":
    main()

import sys

readline = sys.stdin.readline


def main():
    n, m = list(map(int, readline().rstrip().split()))
    hList = list(map(int, readline().rstrip().split()))
    hAns = [1] * n
    for i in range(m):
        a, b = list(map(int, readline().rstrip().split()))
        if hList[a - 1] > hList[b - 1]:
            hAns[b - 1] = 0
            continue
        if hList[a - 1] < hList[b - 1]:
            hAns[a - 1] = 0
            continue
        hAns[a - 1] = 0
        hAns[b - 1] = 0
    print((sum(hAns)))


if __name__ == "__main__":
    main()

+import sys + +readline = sys.stdin.readline + + -    n, m = list(map(int, input().split())) -    hList = list(map(int, input().split())) +    n, m = list(map(int, readline().rstrip().split())) +    hList = list(map(int, readline().rstrip().split())) -        a, b = list(map(int, input().split())) +        a, b = list(map(int, readline().rstrip().split()))