#include <bits/stdc++.h>
using namespace std;
int n, q;
int a[1005], d[1005], mark[1005];
vector<int> v[1005];
void solve() {
  int i, x, y, da, vt, ln, maxx, gt;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= q; i++) {
    cin >> x >> y;
    d[x] += a[y];
    d[y] += a[x];
    v[x].push_back(y);
    v[y].push_back(x);
  }
  da = 0;
  bool si = true;
  while (si) {
    si = false;
    maxx = 0;
    vt = -1;
    for (i = 1; i <= n; i++) {
      if (mark[i] == 0 && (a[i] > maxx || a[i] == maxx && d[i] < gt)) {
        si = true;
        maxx = a[i];
        vt = i;
        gt = d[vt];
      }
    }
    if (vt > 0) da += d[vt], mark[vt] = 1;
    ln = v[vt].size();
    for (i = 0; i < ln; i++) {
      if (mark[v[vt][i]] == 0) {
        d[v[vt][i]] -= a[vt];
      }
    }
  }
  cout << da << endl;
}
int main() {
  while (cin >> n >> q) solve();
  return 0;
}
