#include <bits/stdc++.h>
const int TESTNUM = 1;
using namespace std;
int main_() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > V(n);
  for (int i = 0; i < n; i++) {
    cin >> V[i].first;
    V[i].second = i;
  }
  vector<pair<int, int> > copy = V;
  sort(V.begin(), V.end(), greater<pair<int, int> >());
  vector<vector<int> > G(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    G[a - 1].push_back(b - 1);
    G[b - 1].push_back(a - 1);
  }
  long long res = 0;
  vector<int> mark(n);
  for (int i = 0; i < n; i++) {
    int num = V[i].second;
    mark[num] = 1;
    for (int j = 0; j < (int(G[num].size())); j++)
      if (!mark[G[num][j]]) res += copy[G[num][j]].first;
  }
  cout << res << '\n';
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  for (int i = 0; i < TESTNUM; i++) main_();
  return 0;
}
