#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const double eps = 1e-10;
const int INF = 1e9;
long long exp(long long base, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = (res * base) % MOD;
    }
    n >>= 1;
    base = (base * base) % MOD;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
bool mat[1001][1001];
int main() {
  int n, m, x, y;
  cin >> n >> m;
  long long val;
  vector<pair<long long, int> > energy;
  long long arr[1001];
  for (int i = 1; i <= n; i++) {
    cin >> val;
    energy.push_back(make_pair(val, i));
    arr[i] = val;
  }
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    mat[x][y] = 1;
    mat[y][x] = 1;
  }
  sort(energy.rbegin(), energy.rend());
  long long ans = 0;
  for (int i = 0; i < energy.size(); i++) {
    pair<long long, int> curr = energy[i];
    for (int j = 1; j <= n; j++) {
      if (mat[curr.second][j] == 1) {
        mat[curr.second][j] = 0;
        mat[j][curr.second] = 0;
        ans += arr[j];
      }
    }
  }
  cout << ans;
  return 0;
}
