#include <bits/stdc++.h>
using namespace std;
const int N = 200020;
const int mod = 1000000007;
long long int n;
long long int ar[N];
long long int q;
long long int ans = 0;
int main() {
  cin >> n >> q;
  for (long long int i = 1; i <= n; i++) cin >> ar[i];
  while (q--) {
    long long int x, y;
    cin >> x >> y;
    ans += min(ar[x], ar[y]);
  }
  cout << ans << endl;
  return 0;
}
