#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;

  vector<int> h(n);
  for (auto&& e : h) {
    cin >> e;
  }

  vector<bool> f(n, true);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    f[a] = f[a] && h[a] > h[b];
    f[b] = f[b] && h[b] > h[a];
  }

  int ans = count_if(begin(f), end(f), [](int x){return x;});
  cout << ans << endl;
}
