#include <bits/stdc++.h>
int main() {
  int n, m;
  std::cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  long long result = 0;
  for (int i = 0, x, y; i < m; ++i) {
    std::cin >> x >> y;
    result += std::min(a[x - 1], a[y - 1]);
  }
  std::cout << result;
}
