#include <bits/stdc++.h>

using namespace std;

int n,m,a,b,k[100005],res;
vector <int> friendsList[100005];

int main(){

    scanf("%d%d", &n,&m);

    for(int i=1; i<=n; i++)
        scanf("%d", &k[i]);

    for(int i=1; i<=m; i++){
        scanf("%d%d",&a,&b);
        friendsList[a].push_back(b);
        friendsList[b].push_back(a);
    }

    for(int i=1; i<=n; i++)
        res += k[i] * friendsList[i].size();;

    printf("%d\n", res);

 return 0;
}