#include <bits/stdc++.h>
const int MAXN = 1000;
bool G[MAXN][MAXN] = {0};
long long en[MAXN];
bool Gd[MAXN][MAXN] = {0};
bool was[MAXN] = {0};
int order[MAXN], idx;
bool deleted[MAXN] = {0};
void dfs(int u, int n) {
  int v;
  was[u] = true;
  for (v = 0; v < n; ++v)
    if (Gd[u][v] && !was[v]) dfs(v, n);
  order[idx--] = u;
}
int main() {
  int n, m;
  int i, u, v;
  scanf("%d%d", &n, &m);
  for (u = 0; u < n; ++u) scanf("%I64d", en + u);
  for (i = 0; i < m; ++i) {
    scanf("%d%d", &u, &v);
    --u;
    --v;
    G[u][v] = G[v][u] = true;
    if (en[u] > en[v]) Gd[u][v] = true;
    if (en[v] > en[u]) Gd[v][u] = true;
  }
  idx = n - 1;
  for (u = 0; u < n; ++u)
    if (!was[u]) dfs(u, n);
  long long ans = 0;
  for (i = 0; i < n; ++i) {
    u = order[i];
    for (v = 0; v < n; ++v)
      if (G[u][v] && !deleted[v]) ans += en[v];
    deleted[u] = true;
  }
  printf("%I64d\n", ans);
  return 0;
}
