#include <bits/stdc++.h>
using namespace std;
int m, n, Value[100005], Visited[100005], b[100005];
bool Activated[100005];
vector<int> a[100005];
long long Sum = 0;
bool as_value(int x, int y) { return Value[x] > Value[y]; }
void activate(int u) {
  Activated[u] = true;
  for (int i = 0; int v = a[u][i]; i++)
    if (Activated[v]) Sum += Value[u];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &Value[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) a[i].push_back(0);
  for (int i = 1; i <= n; i++) b[i] = i;
  sort(b + 1, b + n + 1, as_value);
  for (int i = 1; i <= n; i++) activate(b[i]);
  cout << Sum << endl;
}
