#include <bits/stdc++.h>
using namespace std;
const int max_n = 1000;
struct data {
  int pos, val;
  bool operator<(const data &other) const { return val > other.val; }
} a[max_n + 5];
int cost[max_n + 5];
vector<int> g[max_n + 5];
void addedge(int u, int v) {
  g[u].push_back(v);
  cost[v] += a[u].val;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].val), a[i].pos = i;
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d%d", &u, &v);
    addedge(u, v), addedge(v, u);
  }
  sort(a + 1, a + n + 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += cost[a[i].pos];
    for (int j = 0; j < g[a[i].pos].size(); j++)
      cost[g[a[i].pos][j]] -= a[i].val;
  }
  printf("%d\n", ans);
  return 0;
}
