#include <bits/stdc++.h>
long long poww(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  assert(y >= 0);
  for (; y; y >>= 1) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
  }
  return res;
}
using namespace std;
int a[1005], g[1005][1005];
int fnc() {
  int i, ma = -1, mi;
  for (i = 1; i <= 1000; ++i)
    if (a[i] > ma) {
      ma = a[i];
      mi = i;
    }
  if (ma == -1) return ma;
  return mi;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int i, j, k, n, m;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) cin >> a[i];
  while (m--) {
    cin >> i >> j;
    g[i][j] = g[j][i] = 1;
  }
  j = fnc();
  k = 0;
  while (j != -1) {
    for (i = 1; i <= 1000; ++i)
      if (g[i][j] == 1) {
        g[i][j] = g[j][i] = 0;
        k += a[i];
      }
    a[j] = -1;
    j = fnc();
  }
  cout << k << '\n';
  return 0;
}
