#include <bits/stdc++.h>
using namespace std;
long long n,m,a[100005],x[100005],y[100005];
long long sreca[100005],rez;
void resi1(){
    for(int i=1;i<=m;i++){
        if(a[x[i]]>=0 and a[y[i]]>=0){
            sreca[x[i]]++;
            sreca[y[i]]++;
        }
        else if(a[x[i]]<0 and a[y[i]]<0){
            sreca[x[i]]--;
            sreca[y[i]]--;
        }
        else if(a[x[i]]>=0 and a[y[i]]<0){
            if(a[x[i]]<abs(a[y[i]])){
                sreca[x[i]]--;
                sreca[y[i]]--;
            }
            else{
                sreca[x[i]]++;
                sreca[y[i]]++;
            }
        }
        else{
            if(abs(a[x[i]])>a[y[i]]){
                sreca[x[i]]--;
                sreca[y[i]]--;
            }
            else{
                sreca[x[i]]++;
                sreca[y[i]]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        rez+=sreca[i]*a[i];
    }
    cout<<rez<<endl;
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=m;i++){
        cin>>x[i]>>y[i];
    }

    resi1();



return 0;}