#include <iostream>
#define ll long long
using namespace std;
ll a[100010];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, m, x, y, s = 0;
	cin >> n >> m;
	for(ll i = 0; i < n; i++) cin >> a[i];
	for(ll i = 0; i < m; i++)
	{
		cin >> x >> y;
		if(a[x-1] + a[y-1] > 0) s += a[x-1] + a[y-1];
		else s -= a[x-1] + a[y-1];
	}
	cout << s;
}