#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2000;
const long long INF = 2e+9;
const double e = 1e-8;
const int MOD = 1e+9 + 7;
int n, m;
int a[MAXN], b[MAXN];
vector<int> g[MAXN];
bool use[MAXN];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int b, e;
    cin >> b >> e;
    b--, e--;
    g[e].push_back(b);
    g[b].push_back(e);
  }
  sort(b, b + n, [](int x, int y) { return a[x] > a[y]; });
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cerr << b[i] << '\n';
    use[b[i]] = true;
    for (int j = 0; j < (int)g[b[i]].size(); j++) {
      ans += a[g[b[i]][j]] * (!use[g[b[i]][j]]);
    }
  }
  cout << ans;
  return 0;
}
