#include <bits/stdc++.h>
using namespace std;
int n,m,i,o,p;
int pr1,pr2;
int br,br1,sreca,sumasrece;
int druz[100000];
int brpr[100000];
int brnepr[100000];
int prij[100000][2];

int main(){
cin>>n>>m;

  for (int br=0; br<n; ++br){
    cin >> druz[br];
  }
for (br1=0; br1<m; ++br1)
    for (o=0; o<2; ++o)
    {
      cin >> prij[br1][o];
    }

    for (int br=0; br<n; ++br) {
        brpr[br]={};
        brnepr[br]={};
    }

cout <<endl;

for (br1=0; br1<m; ++br1){
     pr1 = prij[br1][0]-1;
     pr2 = prij[br1][1]-1;
     if ((druz[pr1] < 0) || (druz[pr2] < 0)){
        brnepr[pr1] = brnepr[pr1] + 1;
        brnepr[pr2] = brnepr[pr2] + 1;

     } else{
        brpr[pr1] = brpr[pr1] + 1;
        brpr[pr2] = brpr[pr2] + 1;

       }
 }

sumasrece = 0;

 for (int br=0; br<n; ++br) {
  sreca = druz[br]*(brpr[br] - brnepr[br]);
  sumasrece = sumasrece + sreca;

 }

cout << sumasrece <<endl;

return 0;
}