#include <iostream>
using namespace std;

#define N 100002
long long a[N];
pair<long long, long long> b[N];

int main()
{
    long long n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i + 1];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i].first >> b[i].second;
    }
    long long resenje = 0;
    for (int i = 0; i < m; i++)
        resenje += max(a[b[i].first] + a[b[i].second], -(a[b[i].first] + a[b[i].second]));
    cout << resenje;
    return 0;
}