#include <bits/stdc++.h>
using namespace std;
int m1[10000], m2[10000];
int a[10000];
int f[2000][2000];
pair<int, int> b[10000];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    b[i] = make_pair(x, i);
  }
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    f[x][y] = f[y][x] = 1;
  }
  sort(b + 1, b + 1 + n);
  int ans = 0;
  for (int i = n; i; --i) {
    int x = b[i].second;
    for (int j = 1; j < i; ++j)
      if (f[x][b[j].second]) ans += b[j].first;
  }
  printf("%d\n", ans);
  return 0;
}
