#include <iostream>

using namespace std;

int main()
{
    long long int n, m;
    cin >> n >> m;
    int druzeljubivost[n], x[m], y[m], susedi[n];
    for(int i = 0; i < n; i++){
        susedi[i] = 0;
    }

    for(int i = 0; i < n; i++){
        cin >> druzeljubivost[i];
    }

    for(int i = 0; i < m; i++){
        cin >> x[i] >> y[i];
        susedi[x[i]-1]++;
        susedi[y[i]-1]++;
    }

    int suma = 0;
    for(int i = 0; i < n; i++){
        suma += susedi[i] * druzeljubivost[i];
    }

    cout << suma;

    return 0;
}