using System.Collections.Generic;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System;

    namespace cysharp_test
    {
        class Program
        {
            static void Main (string[] args)
            {
                new Program ().solve ();
            }

            void solve ()
            {
                int[] nm = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();
                var N = nm[0];
                var M = nm[1];
                var heights = Console.ReadLine ().Split (' ').Select (long.Parse).ToArray ();
                var connections = new List<int>[N];
                for (int i = 0; i < N; i++) connections[i] = new List<int> ();
                for (int i = 0; i < M; i++)
                {
                    var bridges = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();
                    connections[bridges[0] - 1].Add (bridges[1] - 1);
                    connections[bridges[1] - 1].Add (bridges[0] - 1);
                }

                bool[] canBe = new bool[N];
                for (int i = 0; i < N; i++) canBe[i] = true;
                int count = 0;
                for (int i = 0; i < N; i++)
                {
                    if (!canBe[i]) continue;
                    if (connections[i].Count () == 0)
                    {
                        count++;
                        continue;
                    }
                    else
                    {
                        int c = connections[i].Count ();
                        foreach (var n in connections[i])
                        {
                            if (heights[n] < heights[i])
                            {
                                canBe[n] = false;
                                c--;
                                continue;
                            }
                            else
                            {
                                break;
                            }
                        }
                        if (c == 0) count++;
                    }
                }
                Console.WriteLine (count);
                Console.ReadKey ();
            }

        }
        struct Vector2
        {
            public Vector2 (long x, long y)
            {
                this.x = x;
                this.y = y;
            }

            public long x, y;

            public static Vector2 operator + (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x + b.x, a.y + b.y);
            }

            public static Vector2 operator - (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x - b.x, a.y - b.y);
            }

            public static Vector2 operator * (Vector2 a, long scala)
            {
                return new Vector2 (a.x * scala, a.y + scala);
            }

            public static bool operator == (Vector2 a, Vector2 b)
            {
                return (a.x == b.x) && (a.y == b.y);
            }

            public static bool operator != (Vector2 a, Vector2 b)
            {
                return !(a.x == b.x) && (a.y == b.y);
            }

            public override int GetHashCode ()
            {
                return (int) (x + y);
            }

            public override bool Equals (object obj)
            {
                if (!(obj == null) && obj is Vector2)
                {
                    return (this == (Vector2) obj);
                }
                else return false;
            }

            public override string ToString ()
            {
                return ("(" + x + "," + y + ")");
            }
        }
    }

Measured memory_bytes: 41920