#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int v[1001];
  vector<int> adj[1001];
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  bool removed[1001] = {0};
  int minV, idx;
  int ans = 0;
  do {
    minV = 0;
    idx = -1;
    for (int i = 0; i < n; ++i) {
      if (removed[i]) continue;
      int cost = v[i];
      if (cost > minV) {
        minV = cost;
        idx = i;
      }
    }
    if (idx != -1) {
      removed[idx] = true;
      for (int a : adj[idx]) {
        ans += v[a] * !removed[a];
      }
    }
  } while (idx != -1);
  cout << ans << "\n";
}
