#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
vector<int> g[1020];
struct node {
  int index;
  int deg;
  int val;
} N[1020];
int sum[1020];
bool cmp(node A, node B) { return A.val > B.val; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> N[i].val;
    N[i].index = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    N[a].deg++;
    N[b].deg++;
    sum[a] += N[b].val;
    sum[b] += N[a].val;
  }
  sort(N + 1, N + 1 + n, cmp);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int id = N[i].index;
    ans += sum[id];
    for (auto x = 0; x < g[id].size(); x++) {
      int v = g[id][x];
      sum[v] -= N[i].val;
    }
  }
  cout << ans << endl;
  return 0;
}
