#include <bits/stdc++.h>
using namespace std;
struct node {
  int sum, v;
} s[1010];
int cmp(const void *a, const void *b) {
  node *va = (node *)a;
  node *vb = (node *)b;
  return vb->sum - va->sum;
}
int flag[1010];
int main() {
  int e[1010], mn = 0;
  vector<vector<int> > g(1010);
  int n, m, i, j, k;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> e[i];
  for (i = 0; i < n; i++) {
    s[i].sum = e[i];
    s[i].v = i;
  }
  for (i = 0; i < m; i++) {
    cin >> j >> k;
    g[j - 1].push_back(k - 1);
    g[k - 1].push_back(j - 1);
  }
  qsort(s, n, sizeof(node), cmp);
  for (i = 0; i < n; i++) {
    j = s[i].v;
    flag[j] = 1;
    for (typeof((g[j]).begin()) it = (g[j]).begin(); it != (g[j]).end(); it++) {
      if (flag[*it] == 0) {
        mn += e[*it];
      }
    }
  }
  cout << mn;
  return 0;
}
