#include <bits/stdc++.h>
using namespace std;
const int N = 1124;
vector<int> adj[N];
vector<pair<int, int> > cost;
vector<int> nml;
vector<int> visited;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  cost.resize(n);
  nml.resize(n);
  visited.assign(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> cost[i].first;
    cost[i].second = i;
    nml[i] = cost[i].first;
  }
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int total = 0;
  sort(cost.rbegin(), cost.rend());
  for (int i = 0; i < n; ++i) {
    auto f = cost[i];
    int check = f.second;
    visited[check] = 1;
    for (auto x : adj[check]) {
      if (visited[x] == 0) {
        total += nml[x];
      }
    }
  }
  cout << total << "\n";
  return 0;
}
