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