#include <bits/stdc++.h>
const int MAXN = 1e4 + 5;
int v[MAXN];
int main() {
  int n, m, ans = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", v + i);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    ans = ans + std::min(v[x], v[y]);
  }
  printf("%d\n", ans);
  return 0;
}
