#include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e5 + 7;
const long long INF = 2e18 + 7;
const long long MOD = 1e9 + 7;
const double PI = 3.14;
long long n, m, arr[1001], sum;
vector<int> g[1001];
bool used[1001][1001];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  while (m--) {
    pair<int, pair<int, int> > mn;
    mn.first = MOD;
    for (int i = 1; i <= n; i++) {
      for (int j : g[i]) {
        if (!used[j][i]) {
          if (mn.first > arr[j]) {
            mn.first = arr[j];
            mn.second.first = i;
            mn.second.second = j;
          }
          if (mn.first > arr[i]) {
            mn.first = arr[i];
            mn.second.first = i;
            mn.second.second = j;
          }
        }
      }
    }
    used[mn.second.first][mn.second.second] = true;
    used[mn.second.second][mn.second.first] = true;
    sum += mn.first;
  }
  cout << sum;
  exit(0);
}
