#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
int n, m;
int head[1005], to[4005], nxt[4005], ecnt;
void add_edge(int u, int v) {
  nxt[++ecnt] = head[u];
  to[ecnt] = v;
  head[u] = ecnt;
}
struct node {
  int id, val;
  bool operator<(const node& x) const { return val > x.val; }
} a[1005], b[1005];
int vis[1005];
long long ans;
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++)
    a[i].val = read(), a[i].id = i, b[i].id = i, b[i].val = a[i].val;
  for (int i = 1; i <= m; i++) {
    int u, v;
    u = read(), v = read();
    add_edge(u, v);
    add_edge(v, u);
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = head[a[i].id]; j; j = nxt[j]) {
      int v = to[j];
      if (!vis[v]) ans += b[v].val;
    }
    vis[a[i].id] = 1;
  }
  printf("%lld\n", ans);
  return 0;
}
