#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	long long n,m,ph1,ph2,s=0;
	cin >> n >> m;
	long long Ai[n],pr[n];
	for (int i=0;i<n;i++){
		pr[i] = 0;
		cin >> Ai[i];
	}
	for (int i=0;i<m;i++){
		cin >> ph1 >> ph2;
		pr[ph1-1] += 1;
		pr[ph2-1] += 1;
	}
	for (int i=0;i<n;i++){
		s += Ai[i]*pr[i];
	}
	cout << fabs(s);
}