#include<bits/stdc++.h>
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
using namespace std;
/*ll digni(ll x,ll y)
{
    if(y==0)return 1;
    if(y%2==0)
    {
        ll res=digni(x,y/2);
        return (res*res)%mod;
    }
    return (digni(x,y-1)*x)%mod;
}*/

int n,m;
ll a[100005];
ll b[100005];
ll ans = 0;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        b[i] = 0;
    }

    ll u,v;
    for(int i=0;i<m;i++)
    {
        cin>>u>>v;
        b[u]++;
        b[v]++;

        if(a[u] + a[v] < 0)
        {
            ans -= 2 * (a[u] + a[v]);
        }
    }
    for(int i=1;i<=n;i++)
    {
        ans += a[i] * b[i];
    }

    cout<<ans<<"\n";
 	return 0;
}