#include <bits/stdc++.h>
const long long N = 500005;
const long long mod = 1e9 + 7;
using namespace std;
void solve() {
  long long T = 1;
  while (T--) {
    long long n, m, k, x = 0, y = 0, c = 0, q, ans = 0;
    cin >> n >> k;
    long long a[n];
    for (long long i = 0; i < n; ++i) {
      cin >> a[i];
    }
    for (int i = 0; i < k; ++i) {
      cin >> x >> y;
      c += min(a[x - 1], a[y - 1]);
    }
    cout << c << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
