def getN():

    return int(eval(input()))

def getNM():

    return list(map(int, input().split()))

def getList():

    return list(map(int, input().split()))



from collections import defaultdict

from sys import exit

import math





def main():

    n, m = getList()

    nums = getList()

    tree = [[] for _ in range(n)]

    for i in range(m):

        # start, end, cost

        a, b = getList()

        # 0-indexed

        a -= 1

        b -= 1

        tree[a].append(b)

        tree[b].append(a)

    ans = 0

    for i, t in enumerate(tree):

        cur = nums[i]

        fl = True

        for ne in t:

            if nums[ne] >= cur:

                fl = False



        if fl:

            ans += 1



    print(ans)

if __name__ == "__main__":

    main()
import sys

from collections import defaultdict, deque, Counter

import math



# import copy

from bisect import bisect_left, bisect_right

import heapq



# sys.setrecursionlimit(1000000)



# input aliases

input = sys.stdin.readline



getS = lambda: input().strip()

getN = lambda: int(eval(input()))

getList = lambda: list(map(int, input().split()))

getZList = lambda: [int(x) - 1 for x in input().split()]



INF = 10 ** 20

MOD = 10**9 + 7

divide = lambda x: pow(x, MOD-2, MOD)





def nck(n, k, kaijyo):

    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD





def npk(n, k, kaijyo):

    if k == 0 or k == n:

        return n % MOD

    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD





def kaijyo(n):

    ret = [1]

    for i in range(1, n + 1):

        ret.append((ret[-1] * i)% MOD)

    return ret





def solve():

    n, m = getList()

    nums = getList()

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



    for i in range(m):

        a,b = getZList()

        peaks[a].append(b)

        peaks[b].append(a)

    ans = 0

    for i, num in enumerate(nums):

        flg = True

        for p in peaks[i]:

            if nums[p] >= num:

                flg = False



        if flg:

            ans += 1



    print(ans)





def main():

    n = getN()

    for _ in range(n):

        solve()





if __name__ == "__main__":

    # main()

    solve()
def getN():
    return int(eval(input()))


def getNM():
    return list(map(int, input().split()))


def getList():
    return list(map(int, input().split()))


from collections import defaultdict
from sys import exit
import math


def main():
    n, m = getList()
    nums = getList()
    tree = [[] for _ in range(n)]
    for i in range(m):
        # start, end, cost
        a, b = getList()
        # 0-indexed
        a -= 1
        b -= 1
        tree[a].append(b)
        tree[b].append(a)
    ans = 0
    for i, t in enumerate(tree):
        cur = nums[i]
        fl = True
        for ne in t:
            if nums[ne] >= cur:
                fl = False
        if fl:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
INF = 10**20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i) % MOD)
    return ret


def solve():
    n, m = getList()
    nums = getList()
    peaks = [[] for i in range(n)]
    for i in range(m):
        a, b = getZList()
        peaks[a].append(b)
        peaks[b].append(a)
    ans = 0
    for i, num in enumerate(nums):
        flg = True
        for p in peaks[i]:
            if nums[p] >= num:
                flg = False
        if flg:
            ans += 1
    print(ans)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

-def getN(): -    return int(eval(input())) +import sys +from collections import defaultdict, deque, Counter +import math + +# import copy +from bisect import bisect_left, bisect_right +import heapq + +# sys.setrecursionlimit(1000000) +# input aliases +input = sys.stdin.readline +getS = lambda: input().strip() +getN = lambda: int(eval(input())) +getList = lambda: list(map(int, input().split())) +getZList = lambda: [int(x) - 1 for x in input().split()] +INF = 10**20 +MOD = 10**9 + 7 +divide = lambda x: pow(x, MOD - 2, MOD) -def getNM(): -    return list(map(int, input().split())) +def nck(n, k, kaijyo): +    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD -def getList(): -    return list(map(int, input().split())) +def npk(n, k, kaijyo): +    if k == 0 or k == n: +        return n % MOD +    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD -from collections import defaultdict -from sys import exit -import math +def kaijyo(n): +    ret = [1] +    for i in range(1, n + 1): +        ret.append((ret[-1] * i) % MOD) +    return ret -def main(): +def solve(): -    tree = [[] for _ in range(n)] +    peaks = [[] for i in range(n)] -        # start, end, cost -        a, b = getList() -        # 0-indexed -        a -= 1 -        b -= 1 -        tree[a].append(b) -        tree[b].append(a) +        a, b = getZList() +        peaks[a].append(b) +        peaks[b].append(a) -    for i, t in enumerate(tree): -        cur = nums[i] -        fl = True -        for ne in t: -            if nums[ne] >= cur: -                fl = False -        if fl: +    for i, num in enumerate(nums): +        flg = True +        for p in peaks[i]: +            if nums[p] >= num: +                flg = False +        if flg: +def main(): +    n = getN() +    for _ in range(n): +        solve() + + -    main() +    # main() +    solve()