#include <bits/stdc++.h>
using namespace std;
bool edges[1005][1005];
int n, m, wdeg[1005];
vector<pair<int, int> > v;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int vi;
    cin >> vi;
    v.push_back(make_pair(-vi, i));
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edges[a][b] = edges[b][a] = true;
    wdeg[a] -= v[b].first;
    wdeg[b] -= v[a].first;
  }
  sort(v.begin(), v.end());
  int totalCost = 0;
  for (int i = 0; i < v.size(); i++) {
    int curNode = v[i].second, curVal = v[i].first;
    totalCost += wdeg[curNode];
    for (int j = 0; j < n; j++) {
      if (edges[curNode][j]) {
        edges[curNode][j] = edges[j][curNode] = false;
        wdeg[j] += curVal;
      }
    }
  }
  cout << totalCost << "\n";
  return 0;
}
