#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9, maxn = (int)1e5 + 1;
const double eps = (double)1e-8;
const int mod = (int)1000000009;
int n, m, a[1001], c[1001], x, y, sum, mn, num;
vector<int> b[1001];
bool t[1001];
bool dfs() {
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < b[i].size(); j++)
      if (t[i] && t[b[i][j]]) return 0;
  return 1;
}
int main() {
  scanf("%d", &(n));
  scanf("%d", &(m));
  memset(c, 0, sizeof c);
  for (int i = 1; i <= n; i++) scanf("%d", &(a[i]));
  for (int i = 1; i <= m; i++) {
    scanf("%d", &(x));
    scanf("%d", &(y));
    b[x].push_back(y);
    b[y].push_back(x);
    c[x] += a[y];
    c[y] += a[x];
  }
  sum = 0;
  memset(t, 1, sizeof t);
  while (1) {
    if (dfs()) break;
    mn = -1;
    for (int i = 1; i <= n; i++) {
      if ((t[i]) && (mn == -1 || mn < a[i])) {
        num = i;
        mn = a[i];
      }
    }
    t[num] = 0;
    sum += c[num];
    for (int i = 0; i < b[num].size(); i++) c[b[num][i]] -= a[num];
  }
  cout << sum;
  return 0;
}
