#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
inline T getNext() {
  T s = 1, x = 0, c = getc(stdin);
  while (c <= 32) c = getc(stdin);
  if (c == '-') s = -1, c = getc(stdin);
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getc(stdin);
  return x * s;
}
int d[1500], a[1500];
int main() {
  int n = getNext<int>(), m = getNext<int>();
  for (int i = 1; i != n + 1; i += 1) a[i] = getNext<int>();
  int res = 0;
  for (int i = 0; i != m; i += 1) {
    int x = getNext<int>(), y = getNext<int>();
    res += min(a[x], a[y]);
  }
  cout << res;
  return 0;
}
