#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int N = 1000000 + 5;
const int mod = 1e9 + 7;
const int inf = 2e9;
vector<int> vis(100 + 5, 0);
vector<int> adj[100 + 5];
vector<int> p(N, 0);
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }
int main() {
  int n, m, i, x, y, j;
  long long ans = 0;
  cin >> n >> m;
  int wt[n + 2];
  vector<pair<int, int> > v;
  vector<int> adj[n + 2];
  vector<int> r(n + 2, 0);
  for (i = 1; i <= n; i++) {
    cin >> wt[i];
    v.push_back(make_pair(wt[i], i));
  }
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  sort(v.begin(), v.end(), cmp);
  for (i = 0; i < v.size(); i++) {
    x = v[i].second;
    r[x] = 1;
    for (j = 0; j < adj[x].size(); j++) {
      y = adj[x][j];
      if (r[y] == 0) ans += wt[y];
    }
  }
  cout << ans;
  return 0;
}
