#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int M = 1e5 + 5, mod = 1e9 + 7, INF = 0x3f3f3f3f;
int A[M];
int id[M];
long long val[M];
bool mark[M];
vector<int> edge[M];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int j = 1; j <= n; j++) scanf("%d", &A[j]);
  long long ans = 0;
  for (int j = 1; j <= m; j++) {
    int a, b;
    scanf("%d%d", &a, &b);
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for (int j = 1; j <= n; j++) id[j] = j;
  sort(id + 1, id + 1 + n, [&](int x, int y) { return A[x] > A[y]; });
  for (int j = 1; j <= n; j++) {
    for (int x : edge[id[j]]) {
      if (mark[x]) continue;
      ans += A[x];
    }
    mark[id[j]] = 1;
  }
  printf("%I64d\n", ans);
  return 0;
}
