#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int maina() {
  int T;
  cin >> T;
  for (int _t = 0; _t < T; _t++) {
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  long long N, M;
  cin >> N >> M;
  vector<pair<long long, int> > v(N);
  vector<long long> org(N);
  for (int i = 0; i < N; ++i) {
    long long vv;
    cin >> vv;
    org[i] = vv;
    v[i] = make_pair(vv, i);
  }
  vector<long long> X(M), Y(M);
  vector<vector<long long> > graph(N);
  for (int i = 0; i < M; ++i) {
    cin >> X[i] >> Y[i];
    graph[X[i] - 1].push_back(Y[i] - 1);
    graph[Y[i] - 1].push_back(X[i] - 1);
  }
  sort(v.rbegin(), v.rend());
  vector<int> used(N);
  long long result = 0;
  for (int i = 0; i < N; ++i) {
    int ind = v[i].second;
    for (int j = 0; j < graph[ind].size(); ++j) {
      if (used[graph[ind][j]]) continue;
      result += org[graph[ind][j]];
    }
    used[ind] = 1;
  }
  cout << result;
  return 0;
}
