#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 2, M = 1e9 + 7, OO = 0x3f3f3f3f;
int n, m, u, v;
int ic[N];
int fc[N];
int adj[N][N];
pair<int, int> p[N];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> ic[i];
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    fc[u] += ic[v];
    fc[v] += ic[u];
    adj[u][v] = 1;
    adj[v][u] = 1;
  }
  for (int i = 0; i < n; ++i) p[i] = {ic[i], i};
  sort(p, p + n);
  int ans = 0;
  int t;
  int r = n;
  while (r--) {
    t = p[r].second;
    ans += fc[t];
    for (int i = 0; i < n; ++i) {
      if (adj[t][i]) {
        fc[i] -= ic[t];
        adj[i][t] = 0;
        adj[t][i] = 0;
      }
    }
    fc[t] = OO;
    sort(p, p + n);
  }
  cout << ans << endl;
  return 0;
}
