#include <iostream>
#define MAXN 100005

using namespace std;

static int a[MAXN],b[MAXN];

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        cin>>a[i];
    while(m--)
    {
        int x,y;
        cin>>x>>y;
        b[x-1]++;
        b[y-1]++;
    }
    int zbir=0;
    for(int i=0;i<n;i++)
        zbir+=a[i]*b[i];
    if(zbir<0)zbir=0-zbir;
    cout<<zbir;
    return 0;
}