#include<iostream>
#include<cmath>

using namespace std;

long long provera(long long a, long long b){

long long a1,b1;

a1=abs(a);
b1=abs(b);

if(a>0 && b>0) {
	//cout << "prijatelji provera" << endl;
	return 0;
}
if(a<0 && b<0)
  return 1;
  
  
if(a1>b1) {
	
return a>0?0:1;

}
else{
	
	return b>0?0:1;

}
}


long long a[100000],x[100000][2];	

int main(){
	
long long u=0,n,m,i;	
	
cin >> n >> m;	
	
for(i=0;i<n;i++){

	cin >> a[i];

}
	
for(i=0;i<m;i++){

	long long a1,b;

	cin >> a1 >> b;

	a1=a1-1;
	b=b-1;

  x[a1][provera(a[a1],a[b])]++;
	x[b][provera(a[a1],a[b])]++;
/*
		if(provera(a[a1],a[b])==1){
	
			x[a1][1]++;
			x[b][1]++;
	
		}
		else{

			cout << "prijatelji dodela" << endl;

			x[a1][0]++;
			x[b][0]++;
	
	
		}
*/

}
	
	for(i=0;i<n;i++){
	
	u=u+(a[i] * (x[i][0] - x[i][1] ) );
	
	//cout << a[i] <<  "\t" << x[i][0] <<  "\t" << x[i][1] << endl;
	
	}
	
	cout << u;
	
	return 0;
}