import sys

input = sys.stdin.readline



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

    g = [0] * n

    path = [ [] for i in range(n)]

    #print(ab)

    for l,r in ab:

        path[l-1].append(r)

        path[r-1].append(l)



    #print(path)



    for i,p in enumerate(path):

        if p == []:

            g[i] = 1

            continue

        

        for j in p:

            #print(i+1,j,h[i],h[j-1])

            if h[i] > h[j-1]:

                g[i] = 1

            else:

                g[i] = 0

                break

    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)

    peaks(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)]

    ab_sorted = sorted(ab)

    ppp(n,m,h,ab_sorted)

import sys

input = sys.stdin.readline


def peaks(n, m, h, ab):
    g = [0] * n
    path = [[] for i in range(n)]
    # print(ab)
    for l, r in ab:
        path[l - 1].append(r)
        path[r - 1].append(l)
    # print(path)
    for i, p in enumerate(path):
        if p == []:
            g[i] = 1
            continue
        for j in p:
            # print(i+1,j,h[i],h[j-1])
            if h[i] > h[j - 1]:
                g[i] = 1
            else:
                g[i] = 0
                break
    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)
    peaks(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)]
    ab_sorted = sorted(ab)
    ppp(n, m, h, ab_sorted)

-def peaks(n, m, h, ab): -    g = [0] * n -    path = [[] for i in range(n)] -    # print(ab) +def ppp(n, m, h, ab): +    g = [1] * n -        path[l - 1].append(r) -        path[r - 1].append(l) -    # print(path) -    for i, p in enumerate(path): -        if p == []: -            g[i] = 1 -            continue -        for j in p: -            # print(i+1,j,h[i],h[j-1]) -            if h[i] > h[j - 1]: -                g[i] = 1 -            else: -                g[i] = 0 -                break +        if h[l - 1] >= h[r - 1]: +            g[r - 1] = 0 +        if h[l - 1] <= h[r - 1]: +            g[l - 1] = 0 -    peaks(n, m, h, ab_sorted) +    ppp(n, m, h, ab_sorted)