#include <bits/stdc++.h>
using namespace std;
struct node {
  vector<int> adj;
};
int main() {
  long int n, m, i, x, y, j, min, pos, sum = 0;
  scanf("%ld", &n);
  ;
  scanf("%ld", &m);
  ;
  long int arr[n + 1];
  int status[n + 1];
  for (i = 1; i <= n; ++i) scanf("%ld", &arr[i]);
  ;
  node graph[n + 1];
  for (i = 0; i < m; ++i) {
    scanf("%ld", &x);
    ;
    scanf("%ld", &y);
    ;
    graph[x].adj.push_back(y);
    graph[y].adj.push_back(x);
  }
  int energy[n + 1];
  memset(energy, 0, sizeof(energy));
  memset(status, 0, sizeof(status));
  vector<int>::iterator it;
  for (i = 1; i <= n; ++i) {
    it = graph[i].adj.begin();
    for (; it != graph[i].adj.end(); ++it) energy[i] += arr[*it];
  }
  for (i = 1; i < n; ++i) {
    min = -1;
    for (j = 1; j <= n; ++j) {
      if (arr[j] >= min && status[j] == 0) {
        {
          pos = j;
          min = arr[j];
        }
      }
    }
    status[pos] = 1;
    sum += energy[pos];
    it = graph[pos].adj.begin();
    for (; it != graph[pos].adj.end(); ++it) {
      energy[*it] -= arr[pos];
    }
  }
  printf("%ld\n", sum);
  return 0;
}
