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