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

int n, m;
int a[100005];
int x, y;
int rez;

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= m; ++i)
    {
        scanf("%d %d", &x, &y);
        if (a[x] + a[y] > -a[x] - a[y])
        {
            rez += a[x] + a[y];
        }
        else
        {
            rez += -a[x] - a[y];
        }
    }
    printf("%d\n", rez);
	return 0;
}