#include <bits/stdc++.h>
using namespace std;
bool p[1008][1008];
int b[1008];
struct node {
  int id, val;
  bool operator<(const node& xx) const {
    if (val == xx.val) return id < xx.id;
    return val > xx.val;
  }
} a[1008];
int main() {
  int n, m, i, j, sum;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i].val);
    a[i].id = i;
    b[i] = a[i].val;
  }
  sort(a + 1, a + n + 1);
  memset(p, 0, sizeof(p));
  for (i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    p[u][v] = p[v][u] = true;
  }
  sum = 0;
  for (i = 1; i <= n; i++) {
    int u = a[i].id;
    for (j = 1; j <= n; j++)
      if (p[u][j]) {
        p[u][j] = p[j][u] = false;
        sum += b[j];
      }
  }
  printf("%d", sum);
  return 0;
}
