#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010;
const int maxm = 1000100;
const int INF = 0x3f3f3f3f;
const int mod = 100007;
int n, m;
int a[maxn];
long long sum[maxn];
vector<int> g[maxn];
struct Part {
  int v;
  int num;
} pp[maxn];
bool cmp(Part a, Part b) { return a.v > b.v; }
int main() {
  int i, j;
  int k;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pp[i].v = a[i];
    pp[i].num = i;
  }
  for (i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    sum[x] += a[y];
    sum[y] += a[x];
  }
  sort(pp + 1, pp + n + 1, cmp);
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    int tp = pp[i].v;
    int tx = pp[i].num;
    ans += sum[tx];
    for (j = 0; j < g[tx].size(); j++) {
      int gg = g[tx][j];
      sum[gg] -= tp;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
