#include <bits/stdc++.h>
using namespace std;
const int inf = 0x20202020;
const int mod = 1000000007;
inline void read(int &x) {
  char ch;
  bool f = 0;
  int a = 0;
  while (!((((ch = getchar()) >= '0') && (ch <= '9')) || (ch == '-')))
    ;
  if (ch != '-')
    a *= 10, a += ch - '0';
  else
    f = 1;
  while (((ch = getchar()) >= '0') && (ch <= '9')) a *= 10, a += ch - '0';
  if (f) a = -a;
  x = a;
}
const int DX[] = {1, 0, -1, 0}, DY[] = {0, 1, 0, -1};
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long powmod(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int N = 111111, M = 111111;
int l, m, n, t, v[N], ans, p[N];
vector<int> a[N];
inline bool cmp(const int &x, const int &y) { return v[x] < v[y]; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
  for (int i = 1; i <= m; ++i)
    scanf("%d%d", &l, &t), a[l].push_back(t), a[t].push_back(l);
  for (int i = 1; i <= n; ++i) p[i] = i;
  sort(p + 1, p + 1 + n, cmp);
  for (int _ = n; _ >= 1; --_) {
    int i = p[_];
    v[i] = 0;
    for (int j = 0; j <= ((int)(a[i]).size()) - 1; ++j) ans += v[a[i][j]];
  }
  printf("%d\n", ans);
  return 0;
}
