#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;

    cin >> n >> m;

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

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

    int x, y;
    int a, b, d;

    for(int i = 0; i < m; ++i) {
        cin >> a >> b;

        x = t[a - 1];
        y = t[b - 1];

        if(x * (-1) > y || y * (-1) > x) d = -1;
        else d = 1;

        p[a - 1] += d;
        p[b - 1] += d;
    }

    int s = 0;

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

    cout << s << endl;

    return 0;
}