#include <bits/stdc++.h>
using namespace std;
int N, M, A, B;
vector<int> G[1000];
int h[1000], V[1000];
bool cmp(int a, int b) { return V[a] > V[b]; }
int main() {
  scanf("%d%d", &N, &M);
  for (int(i) = 0; (i) < (N); (i)++) scanf("%d", &V[i]), h[i] = i;
  sort(h, h + N, cmp);
  for (int(i) = 0; (i) < (M); (i)++)
    scanf("%d%d", &A, &B), G[--A].push_back(--B), G[B].push_back(A);
  int ans = 0;
  for (int(_) = 0; (_) < (N); (_)++) {
    int v = h[_];
    for (int(i) = 0; (i) < (G[v].size()); (i)++) ans += V[G[v][i]];
    V[v] = 0;
  }
  printf("%d\n", ans);
}
