#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
long long n, m, a[maxn], ans, d[maxn];
pair<long long, long long> b[maxn];
vector<long long> g[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = make_pair(a[i], i);
  }
  for (long long i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    d[x] += a[y];
    d[y] += a[x];
    g[x].push_back(y);
    g[y].push_back(x);
  }
  sort(b + 1, b + n + 1);
  for (long long i = n; i >= 1; i--) {
    long long x = b[i].second;
    ans += d[x];
    for (long long j = 0; j < g[x].size(); j++) d[g[x][j]] -= a[x];
  }
  cout << ans;
  return 0;
}
