#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> G;
vector<int> price;
int main() {
  int n, m;
  cin >> n >> m;
  G.resize(n);
  price.resize(n);
  priority_queue<pair<int, int>> pq;
  for (int i = 0; i < n; i++) cin >> price[i], pq.push({price[i], i});
  for (int i = 0, s, e; i < m; i++) {
    cin >> s >> e;
    s--;
    e--;
    G[s].emplace_back(e);
    G[e].emplace_back(s);
  }
  int cnt = 0;
  while (!pq.empty()) {
    auto p = pq.top();
    pq.pop();
    for (auto &i : G[p.second]) {
      cnt += price[i];
    }
    price[p.second] = 0;
  }
  cout << cnt;
  return 0;
}
