#include <iostream>

using namespace std;

int main()
{
    long long sum=0;
    int N,M,X,Y;
    cin >> N >> M;
    long long a[N],b[N];
    for(int i=0;i<N;i++)
    {
        cin >> a[i];
        b[i]=0;
    }
    for(int i=0;i<M;i++)
    {
        cin >> X >> Y;
        if(a[X-1]+a[Y-1]>=0)
        {
            b[X-1]=b[X-1]+1;
            b[Y-1]=b[Y-1]+1;
        }
        else
        {
            b[X-1]=b[X-1]-1;
            b[Y-1]=b[Y-1]-1;
        }
        //cout << b[X] << " " << b[Y] << endl;
    }
    for(int i=0;i<N;i++)
    {
        sum=sum+a[i]*b[i];
    }
    cout << sum;
    return 0;
}