#include <bits/stdc++.h>
using namespace std;
vector<long long int> g[1010];
vector<long long int> v(1010);
vector<long long int> price(1010);
void fill(long long int node) {
  price[node] = 0;
  for (auto &i : g[node]) {
    price[node] += v[i];
  }
  return;
}
bool cmp(long long int a, long long int b) {
  if (abs(v[a]) > abs(v[b]))
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 1; i <= n; i++) cin >> v[i];
  for (long long int i = 0; i < m; i++) {
    long long int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (long long int i = 1; i <= n; i++) fill(i);
  vector<long long int> ar;
  for (long long int i = 1; i <= n; i++) ar.push_back(i);
  sort(ar.begin(), ar.end(), cmp);
  long long int ans = 0;
  bool link[n + 10];
  memset(link, true, sizeof(link));
  for (auto &i : ar) {
    long long int temp = 0;
    for (auto &sub : g[i]) {
      if (link[sub]) {
        temp += v[sub];
        link[i] = false;
      }
    }
    ans += temp;
  }
  cout << ans;
  return 0;
}
