#include <bits/stdc++.h>
using namespace std;
int N, M;
const int NMax = 1005;
int Value[NMax], O[NMax], k;
bool Matrix[NMax][NMax];
bool Use[NMax];
vector<int> G[NMax];
long long Sum[NMax], ans;
void Read() {
  cin >> N >> M;
  for (int i = 1; i <= N; i++) cin >> Value[i];
  for (int i = 1; i <= M; i++) {
    int x, y;
    cin >> x >> y;
    if (Value[x] > Value[y]) swap(x, y);
    G[y].push_back(x);
    Sum[x] += Value[y];
    Sum[y] += Value[x];
    Matrix[x][y] = Matrix[y][x] = 1;
  }
}
void DFS(int nod) {
  vector<int>::iterator it;
  Use[nod] = 1;
  for (it = G[nod].begin(); it != G[nod].end(); it++)
    if (!Use[*it]) DFS(*it);
  O[++k] = nod;
}
void Update(int poz) {
  for (int j = 1; j <= N; j++)
    if (Matrix[poz][j] == 1 && Use[j] == 0) Sum[j] -= Value[poz];
}
void findMin() {
  pair<long long, long long> Min = make_pair(100000000000000000, 100005);
  int PMin = 0;
  for (int i = 1; i <= N; i++) {
    if (Use[i] == 1) continue;
    if (Min.first == Sum[i] && Min.second < Value[i])
      Min = make_pair(Sum[i], Value[i]), PMin = i;
    if (Min.first > Sum[i]) {
      Min = make_pair(Sum[i], Value[i]);
      PMin = i;
    }
  }
  ans += Min.first;
  Update(PMin);
  Use[PMin] = 1;
}
int main() {
  Read();
  for (int i = 1; i <= N; i++)
    if (!Use[i]) DFS(i);
  for (int i = 1; i <= N; i++) Use[i] = 0;
  for (int i = k; i >= 1; i--) {
    ans += Sum[O[i]];
    Update(O[i]);
    Use[O[i]] = 1;
  }
  cout << ans << "\n";
  return 0;
}
