#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n;
    int m;
    in >> n >> m;
    vector<int> g[1000];
    vector<pair<int, int>> vv;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      int c;
      in >> c;
      vv.push_back(make_pair(c, i));
      v.push_back(c);
    }
    for (int i = 0; i < m; i++) {
      int x;
      int y;
      in >> x >> y;
      x--;
      y--;
      g[x].push_back(y);
      g[y].push_back(x);
    }
    int ans = 0;
    sort(vv.begin(), vv.end(),
         [](const pair<int, int>& l, const pair<int, int>& r) {
           return l.first > r.first;
         });
    for (int i = 0; i < n; i++) {
      int cind = vv[i].second;
      for (int j = 0; j < g[cind].size(); j++) {
        ans += v[g[cind][j]];
      }
      v[cind] = 0;
    }
    out << ans;
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
