#include <stdio.h>
#include <stdlib.h>


long long int an[100000];

int main()
{
    int n,m;
    long long int res = 0;
    scanf("%d",&n);
    scanf("%d",&m);


    int i;
    for(i=0;i<n;i++){
        scanf("%lli",(an + i));
    }
    int x,y;
    for(i=0;i<m;i++){
        scanf("%d",&x);
        scanf("%d",&y);
        if(an[x-1] + an[y-1] > 0){
        res += (an[x-1] + an[y-1]);
        }
        else{
            res += (an[x-1] + an[y-1]) * -1;
        }
    }

    printf("%lli",res);




    return 0;
}