#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 5;
const int mod = (int)1e9 + 7;
const int inf = 1e9;
const int N = 1e6 + 5;
long long fpow(long long base, long long power) {
  long long result = 1;
  while (power > 0) {
    if (power % 2 == 1) {
      result = (result * base);
    }
    base = (base * base);
    power /= 2;
  }
  return result;
}
long long v[3000];
bool graph[3000][3000];
long long x[3000], y[3000];
int main() {
  memset(graph, 0, sizeof(graph));
  long long n, m;
  cin >> n >> m;
  long long i;
  for (i = 0; i < n; i++) {
    cin >> v[i + 1];
  }
  for (i = 0; i < m; i++) {
    cin >> x[i] >> y[i];
    graph[x[i]][y[i]] = true;
    graph[y[i]][x[i]] = true;
  }
  long long ans = 0;
  for (i = 0; i < m; i++) {
    long long a = x[i];
    long long b = y[i];
    ans += min(v[a], v[b]);
  }
  cout << ans << "\n";
  return 0;
}
