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

const int MAX = 100010;
int a[MAX];

int main () {
    int n, m, p, q;
    long long res = 0;
    scanf("%d%d", &n, &m);
    for(int i = 1 ; i <= n ; i++) scanf("%d", &a[i]);
    while(m--) {
        scanf("%d%d", &p, &q);
        res+= max((a[p] + a[q]), -1 * (a[p] + a[q]));
    }

    printf("%lld\n", res);
    return 0;    
}