#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
long long k, n, m, p;
string s1, s2;
int a[100009], s[100009];
int b[3007][3007];
int main() {
  cin >> n >> m;
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int x, y;
  for (int i = 0; i < m; ++i) {
    cin >> x >> y;
    s += min(a[x - 1], a[y - 1]);
  }
  cout << s;
  int kol234;
  cin >> kol234;
}
