#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y;
};
P a[1009];
vector<int> A[1009];
long long b[1009] = {0};
bool cmp(P p, P q) { return p.y > q.y; }
int n, m, k, i, j, st, fn, S, t;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i].y;
    a[i].x = i;
  }
  for (i = 1; i <= m; i++) {
    cin >> st >> fn;
    b[st] += a[fn].y;
    b[fn] += a[st].y;
    A[st].push_back(fn);
    A[fn].push_back(st);
  }
  sort(a + 1, a + 1 + n, cmp);
  S = 0;
  for (i = 1; i <= n; i++) {
    k = a[i].x;
    S += b[k];
    for (j = 0; j < A[k].size(); j++) {
      t = A[k][j];
      b[t] -= a[i].y;
    }
  }
  cout << S << endl;
  return 0;
}
