#include <bits/stdc++.h>
using namespace std;
int val[1111];
int main() {
  int n, m;
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) cin >> val[i];
    int a, b;
    long long ans = 0;
    for (int i = 0; i < m; i++) cin >> a >> b, ans += min(val[a], val[b]);
    cout << ans << endl;
  }
  return 0;
}
