#include <bits/stdc++.h>

using namespace std;

vector <int> a, as;

long long int RacZbir(int n)
{
    long long int zbir = 0;

    for(int i = 0; i < n; i++)
    {
        zbir += a[i]*as[i];
    }

    return zbir;
}

int main()
{
    int m, n;

    cin >> n >> m;

    for(int i = 0; i < n; i++)
    {
        int pom;

        cin >> pom;
        a.push_back(pom);
        as.push_back(0);
    }

    for(int i = 0; i < m; i++)
    {
        int pomx, pomy;

        cin >> pomx >> pomy;
        if(a[pomx-1] + a[pomy-1] >= -a[pomx-1] -a[pomy-1])
        {
            as[pomx-1] += 1;
            as[pomy-1] += 1;
        }
        else
        {
            as[pomx-1] += -1;
            as[pomy-1] += -1;
        }
    }
    cout << RacZbir(n);

    return 0;
}