#include <bits/stdc++.h>
unsigned v[1111];
int main() {
  unsigned n, q, i, j, r = 0;
  scanf("%u%u", &n, &q);
  for (i = 0; i < n; scanf("%u", v + i++))
    ;
  while (q--) {
    scanf("%u%u", &i, &j);
    --i;
    --j;
    r += (v[i] > v[j]) ? v[j] : v[i];
  }
  printf("%u\n", r);
  return 0;
}
