#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.precision(10), cout << fixed;
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  int ans = 0;
  for (int i = 0, a, b; i < m; ++i) {
    cin >> a >> b;
    ans += min(v[a - 1], v[b - 1]);
  }
  cout << ans << '\n';
  return 0;
}
