#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
const long long int INF = 1e9 + 1;
vector<int> g[1010];
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 0; i < (n); i++) {
    cin >> v[i];
  }
  for (int i = 0; i < (m); i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> off(n), cnt(n, 0);
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < ((int)(g[i]).size()); j++) {
      int to = g[i][j];
      cnt[i] += v[to];
    }
  }
  long long int res = 0;
  for (int i = 0; i < (n); i++) {
    int mini = -1;
    for (int j = 0; j < (n); j++) {
      if (off[j]) continue;
      if (mini == -1 || v[mini] < v[j]) mini = j;
    }
    res += cnt[mini];
    off[mini] = true;
    for (int j = 0; j < ((int)(g[mini]).size()); j++) {
      int to = g[mini][j];
      cnt[to] -= v[mini];
    }
  }
  cout << res;
}
