#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,m,x,y;
	cin>>n>>m;
	ll sol=0;
	ll a[n];
	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]>= -(a[x-1]+a[y-1]))
		sol+=a[x-1]+a[y-1];
		else
		sol+=-(a[x-1]+a[y-1]);
	}
 printf("%lld",sol);
return 0;
}