#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>, greater<pair<int, int> > > s;
int v[1111];
int d[1111];
int n, m;
vector<int> g[1111];
bool no[1111];
int p[1111];
bool comp(int c1, int c2) { return v[c1] > v[c2]; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    p[i] = i;
  }
  sort(p + 1, p + n + 1, comp);
  for (int i = 1; i <= m; ++i) {
    int l, r;
    cin >> l >> r;
    g[l].push_back(r);
    g[r].push_back(l);
  }
  int ans = 0;
  for (int k = 1; k <= n; ++k) {
    int i = p[k];
    for (int j = 0; j < g[i].size(); ++j) {
      if (!no[g[i][j]]) {
        int t = g[i][j];
        ans += v[t];
      }
    }
    no[i] = 1;
  }
  cout << ans;
  return 0;
}
