#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int v[n];
  vector<int> arete[n];
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    arete[a - 1].push_back(b - 1);
    arete[b - 1].push_back(a - 1);
  }
  int res = 0;
  for (int t = 0; t < n; t++) {
    int maxi = 0;
    int tmp = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] > maxi) {
        maxi = v[i];
        tmp = i;
      }
    }
    for (int j = 0; j < (int)arete[tmp].size(); j++) res += v[arete[tmp][j]];
    v[tmp] = 0;
  }
  printf("%d\n", res);
}
