#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+45;

ll n,m,a[N];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }

    ll sol = 0;
    for(int i = 1; i <= m; i++){
        ll u,v;
        cin >> u >> v;
        sol += max(a[u]+a[v],-a[u]-a[v]);
    }
    cout << sol << endl;
}