#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return n & (1LL << pos); }
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
vector<long long> g[5003];
vector<pair<long long, long long> > v1;
vector<bool> vis;
long long solve(long long n) {
  vis.assign(n, 0);
  long long ret = 0;
  for (long long i = 0; i < n; i++) {
    for (auto it : g[v1[i].second]) {
      if (vis[it] == 0) {
        ret += v1[i].first;
      }
    }
    vis[v1[i].second] = 1;
  }
  return ret;
}
int main() {
  long long i, j, k, l, m, n, o, r, q;
  long long testcase;
  long long input, flag, tag, ans;
  while (cin >> n >> m) {
    v1.resize(n);
    for (auto &it : v1) cin >> it.first;
    for (long long i = 0; i <= n; i++) g[i].clear();
    for (long long i = 0; i < n; i++) v1[i].second = i;
    for (long long i = 0; i < m; i++) {
      long long u, v;
      cin >> u >> v;
      u--;
      v--;
      g[u].push_back(v);
      g[v].push_back(u);
    }
    sort(v1.begin(), v1.end());
    ans = solve(n);
    cout << ans << "\n";
  }
}
