#include <bits/stdc++.h>
#define ll long long

using namespace std;

int N;
int M;
ll a [100010];
ll br;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> M;
	for (int i = 0; i < N; i++)
        cin >> a[i];
    for (int i = 0; i < M; i++)
    {
        int X, Y;
        cin >> X >> Y;
        ll pr = a[X - 1] + a[Y - 1];
        ll npr = (-1) * a[X - 1] + (-1) * a[Y - 1];
        br += max (pr,npr);
    }
    cout << br;
	return 0;
}