#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 7, oo = 1e18, mod = 1e9 + 7;
long long n, m, x, y, b[maxn], ok[maxn], res;
pair<long long, long long> a[maxn];
vector<long long> graph[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long i = (1); i <= (n); ++i) {
    cin >> a[i].first;
    a[i].second = i;
    b[i] = a[i].first;
  }
  for (long long i = (1); i <= (m); ++i) {
    cin >> x >> y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  sort(a + 1, a + 1 + n, greater<pair<long long, long long> >());
  for (long long i = (1); i <= (n); ++i) {
    x = a[i].second;
    for (int j : graph[x]) {
      if (!ok[j]) res += b[j];
    }
    ok[x] = 1;
  }
  cout << res;
}
