#include <bits/stdc++.h>
using namespace std;
int N, M, way[1100][1100], used[1100];
int ar[1100], mal[1100], s[1100];
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; i++) cin >> ar[i];
  for (int i = 1, a, b; i <= M; i++) {
    scanf(" %d %d", &a, &b);
    if (!way[a][b]) {
      way[a][b] = 1;
      way[b][a] = 1;
      mal[a] += ar[b];
      mal[b] += ar[a];
      s[a] += ar[a];
      s[b] += ar[b];
    }
  }
  int res = 0;
  for (int z = 1, t; z <= N; z++) {
    int mx = INT_MIN;
    for (int i = 1; i <= N; i++)
      if (!used[i] && ar[i] > mx) {
        t = i;
        mx = ar[i];
      }
    res += mal[t];
    used[t] = 1;
    for (int i = 1; i <= N; i++)
      if (way[t][i]) {
        way[t][i] = way[i][t] = 0;
        s[i] -= ar[i];
        mal[i] -= ar[t];
      }
  }
  cout << res << endl;
  return 0;
}
