#include <iostream>

using namespace std;

int main()
{
    long long n, m, br=0;
    cin >> n >> m;
    long long a[n], x, y;
    for(long long i = 0; i < n; i ++)
        cin >> a[i];
    for(long long j = 0; j < m; j ++){
        cin >> x >> y;
            if((a[x-1]+a[y-1]) > (-1)*(a[x-1] + a[y-1]))
                br += a[x-1]+a[y-1];
            else
                br += (-1)*(a[x-1] + a[y-1]);
          //  br+=br;
            }
    cout << br;
    return 0;
}