#include <bits/stdc++.h>
using namespace std;
vector<int> edge[1010];
vector<pair<int, int> > mas;
bool used[1010];
int cost[1010];
void Solve() {
  int i, j, k, n, m;
  scanf("%d%d", &(n), &(m));
  for (i = 0; i < n; i++) {
    int a;
    scanf("%d", &(a));
    mas.push_back(make_pair(a, i));
    cost[i] = a;
  }
  while (m--) {
    int a, b;
    scanf("%d%d", &(a), &(b));
    a--, b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  sort(mas.begin(), mas.end());
  reverse(mas.begin(), mas.end());
  long long res = 0;
  for (i = 0; i < n; i++) {
    int u = mas[i].second;
    for (j = 0; j < edge[u].size(); j++) {
      int v = edge[u][j];
      if (!used[v]) {
        res += cost[v];
      }
    }
    used[u] = true;
  }
  printf("%I64d", res);
}
int main() {
  Solve();
  return 0;
}
