#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main(){

	int m,n,a,b,s;
	cin>>m>>n;
	vector<int> druz(m);
	vector<int> broji(m);
	s=0;
		
	for(int i=0;i<m;i++){
		cin>>druz[i];
	
	}
	for(int i=0;i<m;i++){
		broji[i]=0;
	}
	for(int k=0;k<n;k++){
			cin>>a;
			cin>>b;
			broji[a-1]=broji[a-1]+1;
			broji[b-1]=broji[b-1]+1;
}
	for(int i=0;i<m;i++){
		
		s=s+(druz[i]*broji[i]);
	}
	cout<<abs(s);
}