#!/usr/bin/env python3

import sys





def solve(N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"):

    l = [[] for i in range(N)]

    for i in range(M):

        l[A[i] - 1].append(B[i])

        l[B[i] - 1].append(A[i])

    nl = [list(set(x)) for x in l]

    cnt = 0

    for i, v in enumerate(nl):

        flg = True

        for j in v:

            if H[i] <= H[j - 1]:

                flg = False

                break

        if flg:

            cnt += 1

    print(cnt)

    return





# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    N = int(next(tokens))  # type: int

    M = int(next(tokens))  # type: int

    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    A = [int()] * (M)  # type: "List[int]"

    B = [int()] * (M)  # type: "List[int]"

    for i in range(M):

        A[i] = int(next(tokens))

        B[i] = int(next(tokens))

    solve(N, M, H, A, B)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3

import sys





def solve(N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"):

    l = [[] for i in range(N)]

    for i in range(M):

        l[A[i] - 1].append(B[i])

        l[B[i] - 1].append(A[i])

    nl = [list(set(x)) for x in l]

    cnt = 0

    for i, v in enumerate(nl):

        h = [H[j - 1] for j in v]

        if not h or H[i] > max(h):

            cnt += 1

    print(cnt)

    return





# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    N = int(next(tokens))  # type: int

    M = int(next(tokens))  # type: int

    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    A = [int()] * (M)  # type: "List[int]"

    B = [int()] * (M)  # type: "List[int]"

    for i in range(M):

        A[i] = int(next(tokens))

        B[i] = int(next(tokens))

    solve(N, M, H, A, B)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"):
    l = [[] for i in range(N)]
    for i in range(M):
        l[A[i] - 1].append(B[i])
        l[B[i] - 1].append(A[i])
    nl = [list(set(x)) for x in l]
    cnt = 0
    for i, v in enumerate(nl):
        flg = True
        for j in v:
            if H[i] <= H[j - 1]:
                flg = False
                break
        if flg:
            cnt += 1
    print(cnt)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, H, A, B)


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"):
    l = [[] for i in range(N)]
    for i in range(M):
        l[A[i] - 1].append(B[i])
        l[B[i] - 1].append(A[i])
    nl = [list(set(x)) for x in l]
    cnt = 0
    for i, v in enumerate(nl):
        h = [H[j - 1] for j in v]
        if not h or H[i] > max(h):
            cnt += 1
    print(cnt)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, H, A, B)


if __name__ == "__main__":
    main()

-        flg = True -        for j in v: -            if H[i] <= H[j - 1]: -                flg = False -                break -        if flg: +        h = [H[j - 1] for j in v] +        if not h or H[i] > max(h):