#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m, x, y, d, s = 0;

    cin >> n >> m;

    vector<int> t(n), p(n, 0);

    for(int i = 0; i < n; ++i) cin >> t[i];

    for(int i = 0; i < m; ++i) {
        cin >> x >> y;

        if(t[x - 1] * (-1) > t[y - 1]) d = -1;
        else d = 1;

        p[x - 1] += d;
        p[y - 1] += d;
    }

    for(int i = 0; i < n; ++i) s += t[i] * p[i];

    cout << s << endl;

    return 0;
}