#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<int> p;
  cin >> n >> m;
  int k;
  for (int i = 0; i < n; i++) {
    cin >> k;
    p.push_back(k);
  }
  int resp = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    resp += min(p[x], p[y]);
  }
  cout << resp << endl;
}
