#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
int N, M, ans, value[1005];
vector<pair<int, int> > val;
set<int> V[1005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M;
  for (int i = 1; i <= N; i++) {
    int A;
    cin >> A;
    value[i] = A;
    val.push_back({A, i});
  }
  sort(val.rbegin(), val.rend());
  while (M--) {
    int A, B;
    cin >> A >> B;
    V[A].insert(B);
    V[B].insert(A);
  }
  for (auto v : val) {
    for (auto x : V[v.second]) {
      ans += value[x];
      V[x].erase(v.second);
    }
  }
  cout << ans << '\n';
  return 0;
}
