#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX / 2;
const double DINF = 1e100;
const int maxn = 1000 + 5;
const int maxm = 2000 + 5;
struct Node {
  int e[maxm], cnt, val, sum1;
  double sum;
};
Node p[maxn];
bool vis[maxn];
int main() {
  int n, m;
  long long ans = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i].val);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    p[a].e[p[a].cnt++] = b;
    p[b].e[p[b].cnt++] = a;
    p[a].sum += p[b].val;
    p[b].sum += p[a].val;
  }
  for (int tt = 1; tt <= n; tt++) {
    int mini = 0;
    int minv = -1;
    for (int i = 1; i <= n; i++) {
      if (!vis[i] && p[i].val > minv) {
        mini = i;
        minv = p[i].val;
      }
    }
    vis[mini] = true;
    for (int i = 0; i < p[mini].cnt; i++) {
      int mm = p[mini].e[i];
      p[mm].sum -= p[mini].val;
    }
    ans += p[mini].sum;
  }
  cout << ans << endl;
  return 0;
}
