#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, val[1005], ans = 0, i, j;
  cin >> n >> m;
  vector<int> con[1005];
  int pri[1005] = {0};
  long long int cost[1005] = {0};
  for (i = 1; i <= n; i++) {
    cin >> val[i];
  }
  for (i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    cost[a] += val[b];
    cost[b] += val[a];
    if (val[a] > val[b]) {
      pri[a] = max(pri[a], pri[b] + 1);
    }
    if (val[a] < val[b]) {
      pri[b] = max(pri[b], pri[a] + 1);
    }
    con[a].push_back(b);
    con[b].push_back(a);
    ans += min(val[a], val[b]);
  }
  cout << ans << "\n";
  return 0;
}
