#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > graph;
vector<long long> cost;
vector<int> xs;
int main(void) {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  graph.resize(n + 1);
  cost.resize(n + 1, 0);
  xs.resize(n + 1);
  for (int i = 1; i <= n; i++) cin >> xs[i];
  for (int i = 0, a, b; i < m; i++) {
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < graph[i].size(); j++) cost[i] += xs[graph[i][j]];
  long long ans = 0;
  vector<char> used(n + 1, 0);
  for (int k = 0; k < n; k++) {
    vector<pair<int, int> > a;
    a.reserve(n - k);
    for (int i = 1; i <= n; i++)
      if (!used[i]) a.push_back(make_pair(xs[i], i));
    sort(a.begin(), a.end());
    int mini = a.back().second;
    ans += cost[mini];
    used[mini] = true;
    cost[mini] = 200000000000000LL;
    for (int i = 0; i < graph[mini].size(); i++)
      cost[graph[mini][i]] -= xs[mini];
  }
  cout << ans << endl;
  return 0;
}
