#include <bits/stdc++.h>
#include<cstdio>
#include <iostream>
#include <string>
using namespace std;

int a[100005];

int main() 
{
    int n, m;
    scanf("%d%d" ,&n, &m);
    
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    
    long long int ans = 0;
    for (int i = 1; i <= m; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        long long int s = 1ll*a[x]+a[y];
        ans += max(s, -s);
    }
    printf("%lld" ,ans);
    return 0;	
}