#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long modx(long long a) { return (a % MOD + MOD) % MOD; }
const int MAXN = 100000;
int N, M, energy[1001], rev[1001], ans;
pair<int, int> need[1001];
vector<vector<int>> adj;
int findIndex(int x) {
  for (int i = 0; i < N; i++) {
    if (need[i].second == x) {
      return i;
    }
  }
  return -1;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> energy[i];
  }
  adj.resize(N);
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    ans += min(energy[x], energy[y]);
  }
  cout << ans;
  return 0;
}
