text: #include <bits/stdc++.h>
  #define REP(i, n) for (int i = 0; i < n; i++)
  #define REPR(i, n) for (int i = n - 1; i >= 0; i--)
  #define FOR(i, m, n) for (int i = m; i <= n; i++)
  #define FORR(i, m, n) for (int i = m; i >= n; i--)
  #define SORT(v, n) sort(v, v + n)
  using namespace std;
  using ll = long long;
  using vll = vector<ll>;
  using vvll = vector<vector<ll>>;
  using P = pair<int, int>;
  using Graph = vector<vector<int>>;
  using Edge = pair<int, ll>;
  const int INF = 1LL << 30;
  const int MAX = 100000;
  const int MOD = 1000000007;
  
  int main()
  {
      // cin高速化
      cin.tie(0);
      ios::sync_with_stdio(false);
      int n, m, a, b;
      cin >> n >> m;
      int ans = 0;
      vector<P> h(n + 1);
      FOR(i, 1, n)
      {
          cin >> h[i].first;
          h[i].second = 1;
      }
      REP(i, m)
      {
          cin >> a >> b;
          if (h[a].first < h[b].first)
              h[a].second = 0;
          else if (h[a].first > h[b].first)
              h[b].second = 0;
          else
          {
              h[a].second = 0;
              h[b].second = 0;
          }
      }
      FOR(i, 1, n)
      if (h[i].second)
          ans++;
      cout << ans << "\n";
      return 0;
  }