#include <bits/stdc++.h>
using namespace std;
int a[1 << 17], mar[1 << 17];
vector<int> v[1 << 17];
int main() {
  int n, m, i, an = 0;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  int cn = 0;
  while (cn < n) {
    int ver;
    for (i = 0; i < n; i++)
      if (!mar[i]) {
        ver = i;
        break;
      }
    for (i = 0; i < n; i++)
      if (!mar[i] && a[i] > a[ver]) ver = i;
    int j, l = v[ver].size();
    for (j = 0; j < l; j++)
      if (!mar[v[ver][j]]) an += a[v[ver][j]];
    mar[ver] = 1;
    cn++;
  }
  printf("%d", an);
  return 0;
}
