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