#include <bits/stdc++.h>
using namespace std;
pair<int, int> c[1005];
long long d[1005];
vector<int> v[1005];
int main(void) {
  long long n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> c[i].first;
  for (int i = 0; i < n; i++) c[i].second = i;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    x--;
    y--;
    d[x] += c[y].first;
    d[y] += c[x].first;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  sort(c, c + n);
  long long ret = 0;
  for (int i = n - 1; i >= 0; i--) {
    x = c[i].second;
    ret += d[x];
    for (int j = 0; j < v[x].size(); j++) {
      d[v[x][j]] -= c[i].first;
    }
  }
  cout << ret << endl;
  return 0;
}
