#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 100;
int v[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> v[i];
  long long ans = 0LL;
  while (m--) {
    cin >> a >> b;
    --a;
    --b;
    ans += (long long)((v[a]) < (v[b]) ? (v[a]) : (v[b]));
  }
  cout << ans << "\n";
}
