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