#include <bits/stdc++.h>
using namespace std;
int n, m, a[1005], x, y;
long long ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ans += min(a[x], a[y]);
  }
  printf("%lld", ans);
  return 0;
}
