#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 7;
bool vis[maxn];
int cost[maxn];
vector<int> v[maxn];
struct node {
  int v, idx;
  bool operator<(const node& b) const { return v < b.v; }
} arr[maxn];
int main() {
  int n, m;
  int l, r;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    v[i].resize(maxn);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", cost + i);
    arr[i] = (node){cost[i], i};
  }
  sort(arr + 1, arr + 1 + n);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &l, &r);
    v[l].push_back(r);
    v[r].push_back(l);
  }
  long long ans = 0ll;
  for (int i = n; i >= 1; --i) {
    int idx = arr[i].idx;
    for (int j = 0; j < (int)v[idx].size(); ++j) {
      if (!vis[v[idx][j]]) {
        ans += (long long)cost[v[idx][j]];
      }
    }
    vis[idx] = 1;
  }
  printf("%lld\n", ans);
  return 0;
}
