#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e6 + 10, inf = 1e18, mod = 1e9 + 7;
struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(const std::pair<T1, T2> &p) const {
    auto h1 = std::hash<T1>{}(p.first);
    auto h2 = std::hash<T2>{}(p.second);
    return h1 ^ h2;
  }
};
long long pw(long long te, long long tee) {
  if (tee == 0) return 1;
  long long res = pw(te, tee / 2);
  return (tee % 2 ? te * res * res : res * res);
}
long long n, m, cost[MAXN], val[MAXN], ans, cnt, place[MAXN];
pair<long long, long long> t[MAXN];
vector<long long> adj[MAXN];
void Read_input() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> val[i];
  cnt = n;
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    cost[u] += val[v];
    cost[v] += val[u];
  }
  for (long long i = 1; i <= n; i++) t[i] = {val[i], i};
}
void Solve() {
  sort(t + 1, t + n + 1, greater<pair<long long, long long>>());
  for (long long i = 1; i <= n; i++) {
    ans += cost[t[i].second];
    long long v = t[i].second;
    for (auto j : adj[v]) cost[j] -= val[v];
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  Read_input(), Solve();
  return 0;
}
