import sys

input = sys.stdin.readline



def ppp(n,m,h,ab):

    g = [1] * n

    for l,r in ab:

        if h[l-1] >= h[r-1]:

            g[r-1] = 0

        if h[l-1] <= h[r-1]:

            g[l-1] = 0

    print((sum(g)))

if __name__ == "__main__":

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

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

    ab = [list(map(int,input().split())) for _ in range(m)]

    ab_sorted = sorted(ab)

    ppp(n,m,h,ab_sorted)

import sys

input = sys.stdin.readline



def ppp(n,m,h,ab):

    g = [1] * n

    for l,r in ab:

        if h[l-1] >= h[r-1]:

            g[r-1] = 0

        if h[l-1] <= h[r-1]:

            g[l-1] = 0

    print((sum(g)))

if __name__ == "__main__":

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

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

    ab = [list(map(int,input().split())) for _ in range(m)]

    ppp(n,m,h,ab)

import sys

input = sys.stdin.readline


def ppp(n, m, h, ab):
    g = [1] * n
    for l, r in ab:
        if h[l - 1] >= h[r - 1]:
            g[r - 1] = 0
        if h[l - 1] <= h[r - 1]:
            g[l - 1] = 0
    print((sum(g)))


if __name__ == "__main__":
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    ab = [list(map(int, input().split())) for _ in range(m)]
    ab_sorted = sorted(ab)
    ppp(n, m, h, ab_sorted)

import sys

input = sys.stdin.readline


def ppp(n, m, h, ab):
    g = [1] * n
    for l, r in ab:
        if h[l - 1] >= h[r - 1]:
            g[r - 1] = 0
        if h[l - 1] <= h[r - 1]:
            g[l - 1] = 0
    print((sum(g)))


if __name__ == "__main__":
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    ab = [list(map(int, input().split())) for _ in range(m)]
    ppp(n, m, h, ab)

-    ab_sorted = sorted(ab) -    ppp(n, m, h, ab_sorted) +    ppp(n, m, h, ab)