#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, e, sum;
  cin >> n >> e;
  int a[n];
  vector<int> V1;
  vector<int> V2;
  for (int l = 0; l < n; l++) {
    cin >> a[l];
    V1.push_back(a[l]);
    V2.push_back(a[l]);
  }
  vector<int> V[n + 1];
  for (int l = 0; l < e; l++) {
    int x, y;
    cin >> x >> y;
    V[x].push_back(y);
    V[y].push_back(x);
  }
  sort(V1.begin(), V1.end());
  reverse(V1.begin(), V1.end());
  int sum1 = 0;
  for (int l1 = 0; l1 < V2.size(); l1++) {
    for (int l = 0; l < V2.size(); l++) {
      if (V1[l1] == V2[l] && V1[l1] != 0) {
        sum = 0;
        for (int l2 = 0; l2 < V[l + 1].size(); l2++) {
          sum = sum + a[V[l + 1][l2] - 1];
        }
        sum1 = sum1 + sum;
        a[l] = 0;
        V1[l1] = 0;
        V2[l] = 0;
      }
    }
  }
  cout << sum1;
}
