#include <bits/stdc++.h>
using namespace std;
bool visited[1010];
vector<int> g[1010];
pair<int, int> v[2010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int i, j, n, k, l, m;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i + 1;
  }
  for (i = 0; i < m; i++) {
    cin >> j >> k;
    g[j].emplace_back(k);
    g[k].emplace_back(j);
  }
  sort(v, v + n);
  long long ans = 0;
  for (i = 0; i < n; i++) {
    j = g[v[i].second].size();
    visited[v[i].second] = 1;
    for (k = 0; k < j; k++)
      if (!visited[g[v[i].second][k]]) ans += (long long)v[i].first;
  }
  cout << ans;
  return 0;
}
