#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int M, N;
    cin >> N >> M;
    int druz[N];
    int pToN[N];
    int sreca = 0;
    for(int i = 0; i < N; i++)
    {
        cin >> druz[i];
        pToN[i] = 0;
    }


    for(int i = 0; i < M; i++) {
        int y, z;
        cin >> y >> z;
        if(abs(druz[y] > abs(druz[z]))) {
            pToN[y - 1] += (druz[y - 1] > 0 ? 1 : -1);
            pToN[z - 1] += (druz[y - 1] > 0 ? 1 : -1);
        }
        else {
            pToN[y - 1] += (druz[z - 1] > 0 ? 1 : -1);
            pToN[z - 1] += (druz[z - 1] > 0 ? 1 : -1);
        }
    }

    for(int i = 0; i < N; i++) sreca += (druz[i] * pToN[i]);
    cout << sreca;
    return 0;
}