#include <bits/stdc++.h>
using namespace std;
const int MAX = 111111;
int n, m;
vector<int> adj[1111];
vector<pair<int, int> > c;
int a[1111], del[1111];
int read() {
  scanf("%d %d", &n, &m);
  c.clear();
  for (int i = (1); i <= (n); i++) {
    int t;
    scanf("%d", &t);
    a[i] = t;
    c.push_back(pair<int, int>(t, i));
  }
  for (int i = 0; i < (m); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  return 0;
}
int process() {
  int ans = 0;
  sort(c.begin(), c.end(), greater<pair<int, int> >());
  for (int i = 0; i < (n); i++) {
    int u, v;
    u = c[i].second;
    if (!del[u])
      for (int j = 0; j < (adj[u].size()); j++) {
        v = adj[u][j];
        if (!del[v]) {
          ans += a[v];
        }
      }
    del[u] = 1;
  }
  printf("%d\n", ans);
  return 0;
}
int main() {
  read();
  process();
  return 0;
}
