#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e3 + 11;
int n, m;
vector<int> edge[N];
int val[N];
bool vis[N];
int main() {
  while (scanf("%d %d", &n, &m) == 2) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &val[i]);
      edge[i].clear();
    }
    int a, b;
    for (int i = 0; i < m; ++i) {
      scanf("%d %d", &a, &b);
      edge[a].push_back(b);
      edge[b].push_back(a);
    }
    long long ans = 0;
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i < n; ++i) {
      int maxl = -INF, v;
      for (int j = 1; j <= n; ++j) {
        if (vis[j] == false) {
          if (val[j] > maxl) maxl = val[j], v = j;
        }
      }
      vis[v] = true;
      for (int j = 0; j < edge[v].size(); ++j) {
        if (vis[edge[v][j]] == false) {
          ans += val[edge[v][j]];
        }
      }
    }
    cout << ans << endl;
  }
}
