#include <bits/stdc++.h>
using namespace std;
int n, m, u, v, cnt[1005], x, y;
pair<int, int> pa[1005];
vector<int> adj[1005];
long long ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &pa[i].first), pa[i].second = i + 1;
  sort(pa, pa + n);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    cnt[u]++;
    cnt[v]++;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    u = pa[i].first;
    v = pa[i].second;
    x = cnt[v];
    ans = ans + 1LL * u * x;
    cnt[v] = 0;
    for (int j = 0; j < adj[v].size(); j++) {
      y = adj[v][j];
      if (cnt[y] > 0) cnt[y]--;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
