#include <bits/stdc++.h>
using namespace std;
long long int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n + 1), comp(n + 1);
  vector<pair<int, int> > q(m);
  for (int i = 1; i <= n; i++) cin >> v[i];
  int cost = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    q[i] = make_pair(x, y);
    comp[x]++;
    comp[y]++;
    if (v[x] < v[y])
      cost += v[x];
    else
      cost += v[y];
  }
  cout << cost;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
