#include <bits/stdc++.h>
using namespace std;
int n, m, ans, w[1010];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d%d", &u, &v);
    ans += min(w[u], w[v]);
  }
  printf("%d\n", ans);
}
