#include <bits/stdc++.h>
using namespace std;
int a[1010];
vector<int> vec[1010];
bool vis[1010];
int b[1010];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) == 2) {
    for (int i = 1; i <= n; i++) vec[i].clear();
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) vis[i] = true;
    memset(b, 0, sizeof(b));
    int u, v;
    int ans = 0;
    while (m--) {
      scanf("%d%d", &u, &v);
      vec[u].push_back(v);
      vec[v].push_back(u);
      b[u] += a[v];
      b[v] += a[u];
      ans += min(a[u], a[v]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
