#include <iostream>
using namespace std;
int main()
{
    int N,i,Ai[100000],S[100000],M,bp[100000],x,y,Ai_ukupno;
    cin>>N>>M;
    Ai_ukupno=0;
    for(i=1;i<=N;i++){
    bp[i]=0;
        cin>>Ai[i];}
    for(i=0;i<=M-1;i++){
    cin>>x>>y;
    bp[x]+=1;
    bp[y]+=1;}
    for(i=1;i<=N;i++){
        S[i]=Ai[i]*bp[i];
        Ai_ukupno+=S[i];}
    cout<<Ai_ukupno;
    return 0;
}