#include <bits/stdc++.h>
using namespace std;
int n, m;
int c[2000];
bool used[2000];
bool e[1002][1002];
long long ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    e[a][b] = e[b][a] = 1;
  }
  for (int i = 0; i < n; i++) {
    m = 0;
    for (int j = 1; j <= n; j++) {
      if (!used[j] && c[j] > c[m]) m = j;
    }
    used[m] = 1;
    for (int j = 1; j <= n; j++) {
      if (!used[j]) ans += c[j] * e[m][j];
    }
  }
  cout << ans << endl;
  return 0;
}
