#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4786)
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, res, u, v, a[10002], i;
  while (cin >> n >> m) {
    for (i = 1; i <= n; i++) cin >> a[i];
    res = 0;
    while (m--) {
      cin >> u >> v;
      res += ((a[u]) < (a[v]) ? (a[u]) : (a[v]));
    }
    cout << res << endl;
  }
  return 0;
}
