#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int maxm = 2005;
struct detail {
  int c[maxm];
  int len;
  int p;
  detail() { len = 0; }
  void add(int i) {
    c[len] = i;
    ++len;
  }
} details[maxn];
int order[maxn];
int n, m;
bool cmp(const int a, const int b) { return details[a].p > details[b].p; }
int main(int argc, const char* argv[]) {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    order[i] = i;
    cin >> details[i].p;
  }
  for (int i = 0; i < m; ++i) {
    int x = 1, y = 1;
    cin >> x >> y;
    x--;
    y--;
    details[x].add(y);
    details[y].add(x);
  }
  sort(order, order + n, cmp);
  long long a = 0;
  for (int i = 0; i < n; ++i) {
    int o = order[i];
    for (int j = 0; j < details[o].len; ++j) {
      a += details[details[o].c[j]].p;
    }
    details[o].p = 0;
  }
  cout << a << endl;
  return 0;
}
