#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > adj;
int main() {
  adj.assign(1007, vector<int>());
  int n, m;
  cin >> n >> m;
  pair<int, int> V[1007];
  int V1[1007];
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    V[i].first = -1 * h;
    V[i].second = i;
    V1[i] = h;
  }
  for (int i = 0; i < m; i++) {
    int o, p;
    cin >> o >> p;
    adj[o - 1].push_back(p - 1);
    adj[p - 1].push_back(o - 1);
  }
  sort(V, V + n);
  vector<bool> vis;
  vis.assign(1007, 0);
  long long int r = 0;
  for (int i = 0; i < n - 1; i++) {
    int nv = V[i].second;
    vis[nv] = 1;
    for (int j = 0; j < adj[nv].size(); j++)
      if (vis[adj[nv][j]] == 0) {
        r += V1[adj[nv][j]];
      }
  }
  cout << r << endl;
  return 0;
}
