#include <bits/stdc++.h>
using namespace std;
const int maxn = 1001;
int n, m, V[maxn], C[maxn];
long long res;
vector<pair<int, int> > W;
vector<int> G[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n && cin >> C[i]; ++i) W.emplace_back(C[i], i);
  for (int i = 0, u, v; i < m && cin >> u >> v; ++i) {
    --u, --v;
    G[u].push_back(v), G[v].push_back(u);
  }
  sort(W.begin(), W.end(), greater<pair<int, int> >());
  for (auto [ignore, u] : W) {
    V[u] = 1;
    for (int v : G[u])
      if (!V[v]) res += C[v];
  }
  cout << res << '\n';
}
