#include <bits/stdc++.h>
using namespace std;
struct node {
  int val, x;
} mm[100005];
int val[100005];
int g[1005][1005];
bool cmp(node a, node b) { return a.val > b.val; }
int main() {
  int n, m, i, j, s, limit;
  memset(g, 0, sizeof(g));
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &mm[i].val);
    val[i] = mm[i].val;
    mm[i].x = i;
  }
  int u, v;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    g[u][v] = g[v][u] = 1;
  }
  sort(mm + 1, mm + 1 + n, cmp);
  int sum = 0;
  for (i = 1; i <= n; i++) {
    s = mm[i].x;
    for (j = 1; j <= n; j++) {
      if (g[s][j]) {
        sum += val[j];
        g[s][j] = g[j][s] = 0;
      }
    }
  }
  printf("%d\n", sum);
}
