#include <bits/stdc++.h>
using namespace std;
int N, M, V[1000];
int adj[1001][1001];
struct node {
  int node_num, cost;
};
node nodes[1000];
bool operator<(const node &a, const node &b) { return a.cost < b.cost; }
int main() {
  while (cin >> N >> M) {
    for (int i = 0; i < N; i++) {
      cin >> V[i];
    }
    memset(adj, 0, sizeof(adj));
    int ret = 0;
    for (int i = 0; i < M; i++) {
      int u, v;
      cin >> u >> v;
      u--, v--;
      adj[u][v] = adj[v][u] = 1;
      ret += min(V[u], V[v]);
    }
    cout << ret << endl;
  }
  return 0;
}
