#include <bits/stdc++.h>
using namespace std;
template <class T>
T sq(T x) {
  return x * x;
}
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
const long long maxint = 2147483647;
const long long minint = -2147483648;
long long val[1010];
vector<int> adj[1010];
long long cost[1010];
int removed[1010];
int vsize[1010];
int n, m;
long long findMin() {
  long long mx = -inf * inf, ind = -1;
  int i, j;
  for (i = 1; i <= n; i++) {
    if (removed[i]) continue;
    if (val[i] > mx) {
      mx = val[i];
      ind = i;
    } else if (val[i] == mx) {
      if (vsize[i] > vsize[ind]) {
        ind = i;
      }
    }
  }
  removed[ind] = 1;
  for (i = 0; i < adj[ind].size(); i++) {
    int t = adj[ind][i];
    cost[t] -= val[ind];
    vsize[t]--;
  }
  return cost[ind];
}
int main() {
  scanf("%d %d", &n, &m);
  int i;
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &val[i]);
  }
  for (i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
    cost[u] += val[v];
    cost[v] += val[u];
    vsize[u]++;
    vsize[v]++;
  }
  long long res = 0;
  for (i = 1; i <= n; i++) {
    res += findMin();
  }
  printf("%I64d\n", res);
  return 0;
}
