#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, result = 0;
  scanf("%d%d", &n, &m);
  int arr[n];
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    if (arr[x - 1] < arr[y - 1])
      result += arr[x - 1];
    else
      result += arr[y - 1];
  }
  printf("%d", result);
}
