#include <bits/stdc++.h>
using namespace std;
int gr[1005][1005], n, m, a[1005], x, y;
long long g[1005];
bool vis[1005];
int main() {
  scanf("%d", &n), scanf("%d", &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int mi = 100000100, l1 = 0;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &x), scanf("%d", &y);
    ans += min(a[x], a[y]);
  }
  cout << ans << endl;
  return 0;
}
