#include <bits/stdc++.h>
const long long INF = 1e18;
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> wts(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> wts[i];
  }
  long long ans = 0;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    ans += min(wts[u], wts[v]);
  }
  cout << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
