#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
const int64_t N = 1e6 + 7;
const int64_t MOD = (int64_t)1e9 + 7;
const int64_t MOD1 = (int64_t)1e9 + 9;
const int64_t MOD2 = 998244353;
const ld pi = atan2(0, -1);
const ld eps = 1e-9;
void solve() {
  int64_t n, m;
  cin >> n >> m;
  vector<vector<int64_t>> adj(n);
  int64_t v[n];
  for (int64_t i = 0; i < n; i++) {
    cin >> v[i];
  }
  int64_t ans = 0;
  while (m--) {
    int64_t x, y;
    cin >> x >> y;
    ans += min(v[x - 1], v[y - 1]);
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  solve();
  return 0;
}
