#include <bits/stdc++.h>
using namespace std;
ifstream fin("A.in");
ofstream fout("A.out");
int n, m, a, b, v[100001], viz[100001];
vector<int> G[100001];
long long sum;
struct sor {
  int x, i;
} s[100001];
bool cmp(sor a, sor b) { return a.x > b.x; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    s[i].x = v[i];
    s[i].i = i;
  }
  for (int i = 1; i <= m; ++i) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  sort(s + 1, s + n + 1, cmp);
  for (int i = 1; i <= n; ++i) {
    viz[s[i].i] = 1;
    for (vector<int>::iterator it = G[s[i].i].begin(); it != G[s[i].i].end();
         ++it) {
      if (!viz[*it]) sum += v[*it];
    }
  }
  cout << sum;
}
