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