#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int i, j, p, q;
  int ans = 0;
  cin >> n >> m;
  int arr[1000][1000];
  for (i = 0; i < 1000; i++)
    for (j = 0; j < 1000; j++) arr[i][j] = 0;
  int w[1000] = {0}, v[1000] = {0};
  for (i = 0; i < n; i++) cin >> w[i];
  for (i = 0; i < m; i++) {
    cin >> p >> q;
    arr[p - 1][q - 1] = 1;
    arr[q - 1][p - 1] = 1;
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      if (arr[i][j]) v[i] += w[j];
  int max = 0;
  for (i = 0; i < n; i++) {
    if (w[i] > max) {
      j = i;
      max = w[i];
    } else if (w[i] == max && v[i] > v[j]) {
      j = i;
      max = w[i];
    }
  }
  while (w[j]) {
    ans += v[j];
    for (i = 0; i < n; i++)
      if (arr[i][j]) v[i] -= w[j];
    w[j] = 0;
    for (i = 0; i < n; i++) {
      arr[i][j] = 0;
      arr[j][i] = 0;
    }
    max = 0;
    for (i = 0; i < n; i++) {
      if (w[i] > max) {
        j = i;
        max = w[i];
      } else if (w[i] == max && v[i] > v[j]) {
        j = i;
        max = w[i];
      }
    }
  }
  cout << ans;
}
