#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
string yes = "YES";
string no = "NO";
long long t = 0, n = 0, m = 0;
long long x0r(long long x, long long y) { return (x | y) & (~x | ~y); }
bool isPalindrome(string str) {
  int l = 0, h = str.length() - 1;
  while (h > l)
    if (str[l++] != str[h--]) return false;
  return true;
}
int main() {
  cin >> n >> m;
  long long a[n + 1], ans = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  while (m--) {
    long long t1, t2;
    cin >> t1 >> t2;
    ans += min(a[t1], a[t2]);
  }
  cout << ans;
}
