#include <bits/stdc++.h>
using namespace std;
int const N_MAX = 10000;
int n, m;
int a[N_MAX];
bool del[N_MAX];
vector<int> adj[N_MAX];
vector<pair<int, int> > val;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    val.push_back(make_pair(a[i], i));
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  sort(val.begin(), val.end());
  reverse(val.begin(), val.end());
  long long ans = 0;
  for (int i = 0; i < (int)val.size(); ++i) {
    int u = val[i].second;
    del[u] = true;
    for (__typeof(adj[u].begin()) it = adj[u].begin(); it != adj[u].end();
         ++it) {
      int v = *it;
      if (!del[v]) {
        ans += a[v];
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
