#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int a[n + 1];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    ans += min(a[u], a[v]);
  }
  cout << ans << endl;
}
