#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5, INF = (int)1e9;
const long double EPS = 1e-9;
int a[N];
long long ans;
int main() {
  int n, m, first, second;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> first >> second;
    ans += 1LL * min(a[first - 1], a[second - 1]);
  }
  cout << ans << endl;
  return 0;
}
