#include <stdio.h>
#include <math.h>

int main()
{
    long long int n,m,sreca=0;
    scanf("%Ld %Ld",&n,&m);
    long long int a[n],x[m],y[m],br[n],brp[n],brn[n];
    for(long long int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        br[i]=0;
        brp[i]=0;
    }
    for(long long int i=0;i<m;i++)
    {
        scanf("%lld %lld",&x[i],&y[i]);
        br[x[i]-1]++;
        br[y[i]-1]++;
        if(a[x[i]-1]+a[y[i]-1]>0)
        {
            brp[x[i]-1]++;
            brp[y[i]-1]++;
        }
    }
    for(long long int i=0;i<n;i++)
    {
        sreca+=a[i]*(2*brp[i]-br[i]);
    }
    printf("%lld",sreca);
    return 0;
}