#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c, d, mx, res = 0;
  cin >> n >> m;
  vector<int> a(n + 1);
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> c >> d;
    mx = min(a[c], a[d]);
    res += mx;
  }
  cout << res;
  return 0;
}
