#include <cstdio>

int main () {
    long N, M, par1, par2, sreca = 0;
    scanf("%ld%ld",&N,&M);
    long druz[N + 2];
    long parniz[M + 2] = {0};
    for(long i = 0; i < N; i++) {
        scanf("%ld",&druz[i]);
    }

    for(long i = 0; i < M; i++) {
        scanf("%ld%ld",&par1,&par2);
        if(druz[par1 - 1] < 0 || druz[par2 - 1] < 0) {
            parniz[par1 - 1]--;
            parniz[par2 - 1]--;
        }
        else {
            parniz[par1 - 1]++;
            parniz[par2 - 1]++;
        }
    }
for(long i = 0; i < N; i++) {
    sreca += (druz[i] * parniz[i]);
}
    printf("%ld", sreca);
    return 0;
}