#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long n, m, x, y, sum = 0;
	cin >> n >> m;
	long long a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < m; i++) {
		cin >> x >> y;
		sum += max(-1 * (a[x-1] + a[y-1]), a[x-1] + a[y-1]);
	}
	cout << sum;
	return 0;
}