#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;
int n, m;
vector<pair<int, int> > g[1000];
int main() {
  scanf("%d%d", &n, &m);
  vector<pair<int, int> > d(n);
  for (int i = 0; i < (int)(n); i++) {
    int x;
    scanf("%d", &x);
    d[i].first = x;
    d[i].second = i;
  }
  for (int i = 0; i < (int)(m); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    if (d[x] < d[y]) swap(x, y);
    g[x].push_back(pair<int, int>(y, d[y].first));
  }
  sort(d.begin(), d.end());
  long long int ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    for (__typeof((g[d[i].second]).begin()) it = (g[d[i].second]).begin();
         it != (g[d[i].second]).end(); ++it)
      ans += it->second;
  }
  cout << ans << endl;
  return 0;
}
