#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b, tot = 0;
  scanf("%d %d", &n, &m);
  int v[n];
  for (a = 0; a < n; a++) scanf("%d", &v[a]);
  while (m--) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    tot += (min(v[a], v[b]));
  }
  printf("%d", tot);
}
