#include <bits/stdc++.h>
using namespace std;
int n, m, a[111169], sum = 0;
int main() {
  int x, y;
  cin >> n >> m;
  for (int i = (0); i < n; i += 1) cin >> a[i];
  for (int i = (0); i < m; i += 1) {
    cin >> x >> y;
    sum += min(a[x - 1], a[y - 1]);
  }
  cout << sum;
  return 0;
}
