#include<iostream>
#include<vector>
#include<numeric>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> H(N);
  for (auto &i : H) cin >> i;
  
  vector<int> bools(N, 1);
  int A, B;
  for (int i=0; i<M; i++) {
    cin >> A >> B;
    A--, B--;
    if (H[A] <= H[B]) bools[A] = 0;
    if (H[A] >= H[B]) bools[B] = 0;
  }
  cout << accumulate(bools.begin(), bools.end(), 0) << endl;
}
