#include<bits\stdc++.h>

using namespace std;

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