function Main(_input) {
    var input = _input.split("\n");
    var firstLine = input[0].split(" ");
    var secondLine = input[1].split(" ");
    var num_N = parseInt(firstLine[0]);
    var num_M = parseInt(firstLine[1]);
    var arr_Height = new Array();
    var arr_Road = new Array();
    var ans = 0;
    for( var i = 0; i < num_N ; i++) { arr_Height.push(parseInt(secondLine[i])); }
    for( var j = 0; j < num_M; j++ ) { arr_Road.push(input[j + 2].split(" ")); }
    for( var m = 0; m < num_N; m++ ){
        var result = true;
        var heightOfTower = arr_Height[m];
        var numTower = m+1;
        for( var h = 0; h < num_M; h++ ){
            var singleRoad = arr_Road[h];
            if( parseInt(singleRoad[0]) == numTower || parseInt(singleRoad[1]) == numTower  ){
                var rivalHeight = singleRoad[0] == numTower ? arr_Height[ parseInt(singleRoad[1]) - 1 ] : arr_Height[ parseInt(singleRoad[0]) - 1 ];
                if( rivalHeight >= heightOfTower ) result = false; 
            }
        }
        if(result) ans++;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));