#include <bits/stdc++.h>
bool U[2005];
int A[2005], B[2005], C[2005], V[2005], N, M;
using namespace std;
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; i++) cin >> V[i];
  for (int i = 0; i < M; i++) cin >> A[i] >> B[i];
  int ans = 0;
  for (int t = 0; t < N; t++) {
    for (int i = 1; i <= N; i++) C[i] = 0;
    for (int e = 0; e < M; e++)
      if (!U[A[e]] && !U[B[e]]) {
        C[A[e]] += V[B[e]];
        C[B[e]] += V[A[e]];
      }
    int highest = -1, best = -1;
    for (int i = 1; i <= N; i++)
      if (!U[i] && V[i] > highest) {
        highest = V[i];
        best = i;
      }
    ans += C[best];
    U[best] = true;
  }
  cout << ans << "\n";
}
