#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
bool avail[maxn];
set<int> s;
int l[maxn], n, m, w[maxn];
vector<int> a[maxn];
void enter() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      int v = a[i][j];
      l[i] += w[v];
    }
  }
}
int main() {
  enter();
  long long res = 0;
  for (int j = 1; j <= n; j++) {
    int mi = 0, k = 0;
    for (int i = 1; i <= n; i++)
      if (!avail[i])
        if (mi < w[i]) {
          k = i;
          mi = w[i];
        }
    res += l[k];
    for (int u = 0; u < a[k].size(); u++) {
      int v = a[k][u];
      l[v] -= w[k];
    }
    avail[k] = 1;
  }
  cout << res;
}
