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