#include <bits/stdc++.h>
using namespace std;
const int INF = 1e+9;
vector<int> G[1001];
int a[1001], n, m, v, u, ans, i, j;
set<pair<int, int> > X;
int b[1001];
int c[1001];
bool have[1001];
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i];
  for (j = 0; j < m; j++) {
    cin >> v >> u;
    v--;
    u--;
    G[v].push_back(u);
    G[u].push_back(v);
  }
  for (i = 0; i < n; i++) {
    int sum = 0;
    for (j = 0; j < G[i].size(); j++) sum += a[G[i][j]];
    X.insert(make_pair(a[i], i));
    b[i] = sum;
    c[i] = G[i].size();
    have[i] = true;
  }
  while (X.size() != 0) {
    pair<int, int> p = *X.rbegin();
    X.erase(p);
    have[p.second] = false;
    ans += b[p.second];
    for (int i = 0; i < G[p.second].size(); i++) {
      v = G[p.second][i];
      if (!have[v]) continue;
      X.erase(make_pair(a[v], v));
      b[v] -= a[p.second];
      c[v] -= 1;
      X.insert(make_pair(a[v], v));
    }
  }
  cout << ans << endl;
  return 0;
}
