#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int p[MAXN];
int a[MAXN];
bool e[MAXN][MAXN];
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < (n); ++i) scanf("%d", a + i);
  for (int i = 0; i < (m); ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    e[a][b] = e[b][a] = true;
  }
  for (int i = 0; i < (n); ++i) p[i] = i;
  sort(p, p + n, [](const int &x, const int &y) { return a[x] > a[y]; });
  int ans = 0;
  for (int pi = 0; pi < (n); ++pi) {
    int i = p[pi];
    for (int j = 0; j < (n); ++j)
      if (e[i][j]) ans += a[j];
    a[i] = 0;
  }
  printf("%d\n", ans);
  return 0;
}
