#include <iostream>

using namespace std;

int main()
{

  int m, n;
  cin >> n >> m;
  int a[n];
  int p[n];
  int resenje = 0;
  int x, y;

  for(int i = 0;i < n;i++){
    p[i] = 0;
    }


  for(int i = 0; i < n;i++){
    cin >> a[i];
}

  for(int i = 0; i < m;i++){
    cin >> x >> y;

    if(a[x-1] < 0 || a[y-1] < 0){
        p[x-1] -= 1;
        p[y-1] -= 1;

    }

    else{
             p[x-1] += 1;
             p[y-1] += 1;


    }

}
for(int i = 0;i < n;i++){
    resenje += (a[i]*p[i]);}

cout << resenje;





     return 0;
}