#include <iostream>
#include<vector>
using namespace std;

long long int max(long long int a, long long int b)
{
	if (a > b)return a;
	return b;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	long long int sum = 0;
	vector<long long int> a;
	int n, m;
	


	cin >> n >> m;
	a.push_back(0);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a.push_back(x);
	}
	for (int i = 0; i < m; i++) {

		int x, y;
		cin >> x >> y;
		sum += max(a[x] + a[y], -a[x] - a[y]);


	}

	cout << sum;



}