#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fi first
#define se second
#define ld long double
#define MAXC 10000000
#define N_MAX 100010

using namespace std;
vector<int>al[N_MAX];
void solve() {
	int n, m ;
	cin >> n >> m ;

	vector<ll>v(n);
	for (int i = 0 ; i < n ; i++ )cin >> v[i];

	for (int i = 0 ; i < m ; i++ ) {
		ll x,y;
		cin >> x >> y ;
		x--;y--;
		al[x].pb(y);
		al[y].pb(x);
	}

	ll resenje =0  ;
	for (int i = 0 ; i < n ; i++ ) {
		resenje += v[i]*((ll)al[i].size());
	}

	cout << resenje << endl ;
} 


int main () {
 	/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
 	/*/
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

 
    int t =1;
    //cin >>t ;
    while(t--) 
        solve();
}