from heapq import heapify, heappush, heappop

from heapq import _heapify_max, _heappop_max

import heapq



def _heappush_max(heap, item):

    heap.append(item)

    heapq._siftdown_max(heap, 0, len(heap)-1)



"""

method:

    heapify(x): ヒープに変換

    heappush(heap, item): itemをheapにpush

    heappop(heap): heapから最小値を取得 空の場合はIndexError

note:

    max heapにする場合は、prefix: _ とsuffix: _maxをつければ良い

"""

def main():

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

    h = [0] + list(map(int, input().split()))

    ans = [[] for _ in range(n+1)]

    for _ in range(m):

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

        _heappush_max(ans[a], h[b])

        _heappush_max(ans[b], h[a])

    out = 0

    for ai, hi in zip(ans[1:], h[1:]):

        if (not ai) or hi > _heappop_max(ai):

            out += 1

    print(out)



if __name__ == "__main__":

    main()

def main():

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

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

    to = [0]*(n+1)

    ans = 0

    for _ in range(m):

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

        to[a] = max(to[a], h[b-1])

        to[b] = max(to[b], h[a-1])

    for i, hi in enumerate(h, 1):

        t = to[i]

        if t == 0 or hi > t:

            ans += 1

    print(ans)



if __name__ == "__main__":

    main()
from heapq import heapify, heappush, heappop
from heapq import _heapify_max, _heappop_max
import heapq


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


"""
method:
    heapify(x): ヒープに変換
    heappush(heap, item): itemをheapにpush
    heappop(heap): heapから最小値を取得 空の場合はIndexError
note:
    max heapにする場合は、prefix: _ とsuffix: _maxをつければ良い
"""


def main():
    n, m = list(map(int, input().split()))
    h = [0] + list(map(int, input().split()))
    ans = [[] for _ in range(n + 1)]
    for _ in range(m):
        a, b = list(map(int, input().split()))
        _heappush_max(ans[a], h[b])
        _heappush_max(ans[b], h[a])
    out = 0
    for ai, hi in zip(ans[1:], h[1:]):
        if (not ai) or hi > _heappop_max(ai):
            out += 1
    print(out)


if __name__ == "__main__":
    main()

def main():
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    to = [0] * (n + 1)
    ans = 0
    for _ in range(m):
        a, b = list(map(int, input().split()))
        to[a] = max(to[a], h[b - 1])
        to[b] = max(to[b], h[a - 1])
    for i, hi in enumerate(h, 1):
        t = to[i]
        if t == 0 or hi > t:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-from heapq import heapify, heappush, heappop -from heapq import _heapify_max, _heappop_max -import heapq - - -def _heappush_max(heap, item): -    heap.append(item) -    heapq._siftdown_max(heap, 0, len(heap) - 1) - - -""" -method: -    heapify(x): ヒープに変換 -    heappush(heap, item): itemをheapにpush -    heappop(heap): heapから最小値を取得 空の場合はIndexError -note: -    max heapにする場合は、prefix: _ とsuffix: _maxをつければ良い -""" - - -    h = [0] + list(map(int, input().split())) -    ans = [[] for _ in range(n + 1)] +    h = list(map(int, input().split())) +    to = [0] * (n + 1) +    ans = 0 -        _heappush_max(ans[a], h[b]) -        _heappush_max(ans[b], h[a]) -    out = 0 -    for ai, hi in zip(ans[1:], h[1:]): -        if (not ai) or hi > _heappop_max(ai): -            out += 1 -    print(out) +        to[a] = max(to[a], h[b - 1]) +        to[b] = max(to[b], h[a - 1]) +    for i, hi in enumerate(h, 1): +        t = to[i] +        if t == 0 or hi > t: +            ans += 1 +    print(ans)