#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, m;
int val[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> val[i];
  }
  int ans = 0;
  while (m--) {
    int u, v;
    cin >> u >> v;
    ans += min(val[u], val[v]);
  }
  cout << ans << '\n';
  return 0;
}
