#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const double eps = 1e-9;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  vector<int> cost(n, 0);
  vector<vector<int> > g(n);
  vector<bool> in(n, true);
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
    cost[a] += v[b];
    cost[b] += v[a];
  }
  int t = 0;
  for (int i = 0; i < n; ++i) {
    int mn = -inf;
    int ind = -1;
    for (int j = 0; j < n; ++j) {
      if (v[j] > mn and in[j]) {
        mn = v[j];
        ind = j;
      }
    }
    if (ind == -1) break;
    t += cost[ind];
    in[ind] = false;
    for (int j = 0; j < int(g[ind].size()); ++j) {
      int k = g[ind][j];
      cost[k] -= v[ind];
    }
  }
  cout << t << endl;
}
