#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxN = 1000;
int N, E;
int value[maxN + 1];
pair<int, int> sorted[maxN + 1];
vector<int> adj[maxN + 1];
bool mark[maxN + 1];
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> E;
  for (int i = (1); i < (N + 1); i++) cin >> value[i];
  for (int e = (0); e < (E); e++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = (1); i < (N + 1); i++) sorted[i] = make_pair(value[i], i);
  sort(sorted + 1, sorted + N + 1, greater<pair<int, int> >());
  int res = 0;
  for (int i = (1); i < (N + 1); i++) {
    int kill = sorted[i].second;
    mark[kill] = true;
    for (int to : adj[kill]) {
      if (mark[to]) continue;
      res += value[to];
    }
  }
  cout << res << endl;
}
