#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <limits>
 
int main() {
 
    int64_t N, M;
    std::cin >> N >> M;
 
    std::vector<int64_t> Hs(N+1);
    for (int64_t i = 1; i <= N; ++i) {
        std::cin >> Hs.at(i);
    }
 
    std::set<std::pair<int64_t, int64_t>> pairs;
    std::vector<int64_t> obs(N+1, 1);
 
    auto disable = [&](int64_t idx) {
        if (obs.at(idx) == 1) N--;
        obs.at(idx) = 0;
    };
 
    for (int64_t i = 0; i < M; ++i) {
 
        int64_t A, B;
        std::cin >> A >> B;
        
        if (Hs.at(A) == Hs.at(B)) {
            disable(A);
            disable(B);
            continue;
        }
 
        if (Hs.at(A) > Hs.at(B)) {
            disable(B);
        } else {
            disable(A);
        }
    }
 
    std::cout << N << std::endl;
 
    return 0;
}