#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int>, vector<pair<int, int> >, less<pair<int, int> > >
    p;
int n, m, ans, ask;
int now, head[100086], a[100086], x, y, vis[100086];
struct node {
  int next, to;
} edge[100086];
void add(int x, int y) {
  now++;
  edge[now].to = y;
  edge[now].next = head[x];
  head[x] = now;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    p.push(make_pair(a[i], i));
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    add(x, y);
    add(y, x);
  }
  while (!p.empty()) {
    int x = p.top().second;
    p.pop();
    vis[x] = 1;
    for (int i = head[x]; i; i = edge[i].next) {
      int to = edge[i].to;
      if (!vis[to]) {
        ans += a[to];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
