#include <bits/stdc++.h>
using namespace std;
const int OnlineJudge = 1;
const int maxn = 1912;
int a[maxn];
int n, m;
set<int> V[maxn];
int id[maxn];
bool cmp(const int x, const int y) { return a[x] < a[y]; }
int main() {
  std ::ios_base::sync_with_stdio(false);
  cin.tie(0);
  if (OnlineJudge) {
  } else
    freopen("input.inp", "r", stdin);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    V[u].insert(v);
    V[v].insert(u);
  }
  for (int i = 1; i <= n; i++) id[i] = i;
  sort(id + 1, id + 1 + n, cmp);
  int ans = 0;
  for (int i = n; i >= 1; i--) {
    int u = id[i];
    for (set<int>::iterator it = V[u].begin(); it != V[u].end(); ++it) {
      int v = (*it);
      V[v].erase(V[v].find(u));
      ans += a[v];
    }
  }
  printf("%d\n", ans);
  return 0;
}
