#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, temp, x, y, sum = 0;
  vector<vector<int> > adj;
  vector<int> value, node, flag;
  queue<int> q;
  cin >> n >> m;
  adj.assign(n, vector<int>(n, 0));
  node.assign(n, 0);
  flag.assign(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    value.push_back(temp);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    adj[x - 1][y - 1] = 1;
    adj[y - 1][x - 1] = 1;
    node[x - 1]++;
    node[y - 1]++;
    if (value[x - 1] <= value[y - 1]) flag[y - 1]++;
    if (value[y - 1] <= value[x - 1]) flag[x - 1]++;
  }
  for (int i = 0; i < n; ++i)
    if (flag[i] == node[i]) q.push(i);
  while (!q.empty()) {
    temp = q.front();
    q.pop();
    for (int i = 0; i < n; ++i) {
      if (adj[temp][i]) {
        sum += value[i];
        adj[temp][i] = 0;
        adj[i][temp] = 0;
        node[i]--;
        if (value[temp] == value[i]) flag[i]--;
        if (node[i] == flag[i]) q.push(i);
      }
    }
  }
  cout << sum << endl;
  return 0;
}
