#include <bits/stdc++.h>
using namespace std;
const int Nmax = 2001;
int v[Nmax];
int N, M, Ans;
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) cin >> v[i];
  int x, y;
  for (int i = 1; i <= M; ++i) {
    cin >> x >> y;
    Ans += (v[x] < v[y] ? v[x] : v[y]);
  }
  cout << Ans << '\n';
  return 0;
}
