#include <bits/stdc++.h>
using namespace std;
const int Size = 1000;
int ar[Size + 5] = {};
int grid[Size + 5][Size + 5] = {};
int n, m;
int Cost = 0;
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    grid[a][b] = 1;
    grid[b][a] = 1;
  }
  for (int i = 1; i <= n; i++) {
    bool ok = true;
    while (ok) {
      ok = false;
      for (int j = 1; j <= n; j++) {
        if (grid[i][j] == 1) {
          ok = true;
          int mini = min(ar[i], ar[j]);
          Cost += mini;
          grid[i][j] = 0;
          grid[j][i] = 0;
          break;
        }
      }
    }
  }
  cout << Cost << endl;
}
int main() {
  solve();
  return 0;
}
