#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = (0); i < (int)(n); ++i) cin >> v[i];
  vector<vector<int>> adj(n, vector<int>(n, 0));
  for (int i = (0); i < (int)(m); ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x][y] = adj[y][x] = 1;
  }
  vector<pair<int, int>> vv(n);
  for (int i = (0); i < (int)(n); ++i) vv[i] = make_pair(-v[i], i);
  sort((vv).begin(), (vv).end());
  int res = 0;
  for (int i = (0); i < (int)(n); ++i) {
    for (int j = (0); j < (int)(n); ++j) {
      res += adj[vv[i].second][j] * v[j];
      adj[vv[i].second][j] = adj[j][vv[i].second] = 0;
    }
  }
  cout << res << endl;
  return 0;
}
