#include <bits/stdc++.h>
using namespace std;
long long int m, n;
long long int a[1000007];
long long int res = 0;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  while (m-- > 0) {
    long long int x, y;
    cin >> x >> y;
    res += min(a[x], a[y]);
  }
  cout << res;
  return 0;
}
