#include <bits/stdc++.h>
using namespace std;
int n, m;
long long int res = 0;
vector<vector<int> > Graph;
vector<pair<int, int> > cost;
int Visted[100005] = {};
int c[100005];
int main() {
  scanf("%d%d", &n, &m);
  cost.resize(n), Graph.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &cost[i].first);
    cost[i].second = i;
    c[i] = cost[i].first;
  }
  for (int i = 0, x, y; i < m; i++) {
    scanf("%d%d", &x, &y);
    Graph[x - 1].push_back(y - 1);
    Graph[y - 1].push_back(x - 1);
  }
  sort(cost.rbegin(), cost.rend());
  for (int i = 0; i < n; i++) {
    if (!Visted[cost[i].second]) {
      Visted[cost[i].second] = 1;
      for (int j = 0; j < Graph[cost[i].second].size(); j++) {
        if (!Visted[Graph[cost[i].second][j]])
          res += c[Graph[cost[i].second][j]];
      }
    }
  }
  printf("%lld", res);
  return 0;
}
