#include <iostream>
using namespace std;
int druzeljubivost[100000] = {0};
int main(){
    int n,m;
    cin >> n >> m;
    for(int i = 0;i < n;i++){
        int a;
        cin >> a;
        druzeljubivost[i] = a;
    }
    int sum = 0;
    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b;
        sum += abs(druzeljubivost[a-1] + druzeljubivost[b-1]);
    }
    cout << sum;
}