#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  while (m--) {
    long long f, b;
    cin >> f >> b;
    --f, --b;
    ans += min(a[f], a[b]);
  }
  cout << ans;
  return 0;
}
