#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long visited[n], iniCost[n];
  pair<long long, long long> cost[n];
  memset(visited, 0, sizeof(visited));
  pair<long long, long long> a;
  for (long long i = 0; i < n; ++i) {
    cin >> iniCost[i];
    a.first = iniCost[i];
    a.second = i;
    cost[i] = a;
  }
  sort(cost, cost + n);
  vector<long long> adj[n];
  long long x, y, ans = 0;
  for (long long i = 0; i < m; ++i) {
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (long long i = n - 1; i >= 0; --i) {
    visited[cost[i].second] = 1;
    for (long long x : adj[cost[i].second]) {
      if (!visited[x]) {
        ans += iniCost[x];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
