#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
int n, m;
int cost[MAXN];
int v[MAXN];
int a[MAXN], b[MAXN];
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &v[i]);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    a[i] = x;
    b[i] = y;
  }
  for (int i = 0; i < m; ++i) {
    cost[a[i]] += v[b[i]];
    cost[b[i]] += v[a[i]];
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int best = -1;
    for (int j = 0; j < n; ++j)
      if (cost[j] >= 0)
        if (best == -1 || v[best] < v[j]) best = j;
    ans += cost[best];
    cost[best] = -1;
    for (int j = 0; j < m; ++j)
      if (a[j] == best)
        cost[b[j]] -= v[best];
      else if (b[j] == best)
        cost[a[j]] -= v[best];
  }
  printf("%d\n", ans);
  return 0;
}
