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

int friendness[100005];
pair<int, int> ships[100005];
int myfriends[100005];

int main()
{
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; ++i){
        cin >> friendness[i];
    }
    for(int i = 0; i < m; ++i){
        cin >> ships[i].first >> ships[i].second;
        ships[i].first--;
        ships[i].second--;
    }

    for(int i = 0; i < m; ++i){
        int a = friendness[ships[i].first];
        int b = friendness[ships[i].second];
        int x = ships[i].first;
        int y = ships[i].second;
        if(a >= 0 && b >= 0){
            myfriends[x]++;
            myfriends[y]++;
        }else if(a <= 0 && b <= 0){
            myfriends[x]--;
            myfriends[y]--;
        }else{
            if(a >= 0){
                if(a >= abs(b)){
                    myfriends[x]++;
                    myfriends[y]++;
                }else{
                    myfriends[x]--;
                    myfriends[y]--;
                }
            }else{
                if(b >= abs(a)){
                    myfriends[x]++;
                    myfriends[y]++;
                }else{
                    myfriends[x]--;
                    myfriends[y]--;
                }
            }
        }
    }

    long long res = 0;
    for(int i = 0; i < n; ++i){
        res += 1LL * myfriends[i] * friendness[i];
    }
    cout << res << "\n";
    return 0;
}