#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, a[1010];
inline void read(int& x) {
  char ch = getchar();
  int mk = 1;
  for (; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') mk = -1, ch = getchar();
  for (x = 0; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - 48;
  x *= mk;
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= n; i++) read(a[i]);
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    read(x);
    read(y);
    sum += min(a[x], a[y]);
  }
  printf("%d\n", sum);
  return 0;
}
