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

int main()
{
    int n, m;
    cin >> n >> m;
    int a[n];
    vector<int> k(n+1, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        k[x]++;
        k[y]++;
    }
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        long long x = a[i] * k[i+1];
    }
    cout << sum << "\n";
    return 0;
}