#include <iostream>

using namespace std;

int main()
{
    int n, m, z = 0;
    cin >> n >> m;
    int a[n], b[m][2];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < m; i++)
        for (int j = 0; j < 2; j++)
            cin >> b[i][j];
    int c[n] = {0};
    for (int i = 0; i < n; i++){
        c[b[i][0] - 1]++;
        c[b[i][1] - 1]++;
    }
    for (int i = 0; i < n; i++)
        z = z + a[i] * c[i];
    if (z < 0) z = -z;
    cout << z;
	return 0;
}