#include <bits/stdc++.h>
using namespace std;
bool sortcoll(vector<long long int> &v1, vector<long long int> &v2) {
  return v1[1] < v2[1];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  long long int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  ;
  vector<vector<long long int> > graph(n, vector<long long int>(n, INT_MAX));
  while (m--) {
    long long int x, y;
    cin >> x >> y;
    graph[x - 1][y - 1] = arr[y - 1];
    graph[y - 1][x - 1] = arr[x - 1];
  }
  long long int minCost = 0;
  for (int i = 0; i < n - 1; i++) {
    long long int maxpos = 0;
    for (int i = 1; i < n; i++) {
      if (arr[i] > arr[maxpos]) maxpos = i;
    }
    long long int cost = 0;
    vector<long long int> index;
    for (int i = 0; i < n; i++) {
      if (arr[i] == arr[maxpos]) index.push_back(i);
    }
    long long int count = 0;
    for (int j = 0; j < n; j++) {
      if (graph[maxpos][j] != INT_MAX) {
        cost += graph[maxpos][j];
        count++;
      }
    }
    for (int k = 0; k < index.size(); k++) {
      long long int temp = 0, sum = 0;
      for (int j = 0; j < n; j++) {
        if (graph[index[k]][j] != INT_MAX) {
          temp++;
          sum += graph[index[k]][j];
        }
      }
      if (temp > count) {
        count = temp;
        cost = sum;
        maxpos = index[k];
      }
    }
    minCost += cost;
    for (int j = 0; j < n; j++) {
      if (graph[maxpos][j] != INT_MAX) {
        graph[maxpos][j] = INT_MAX;
        graph[j][maxpos] = INT_MAX;
      }
    }
    arr[maxpos] = INT_MIN;
  }
  cout << minCost;
  return 0;
}
