#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    int brojac = 0;
    map<int, int> mapa;
    int a[n];
    int b1[m], b2[m];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        mapa[i+1] = a[i];
    }
    for(int i = 0; i < m; i++)
    {
        cin >> b1[i] >> b2[i];
        brojac += abs(mapa[b1[i]] + mapa[b2[i]]);
    }
    cout << brojac;
    return 0;
}