#include <iostream>
#include <bits/stdc++.h>

using namespace std;

class Graph {
    private:
        int V;
        list<int>* adj;
    public:
        Graph(int v){
            V = v;
            adj = new list<int>[V];
        }

        void addEdge(int u, int v){
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
        ~Graph(){
            delete[] adj;
        }
        int povez (int S)
        {
            int y=0;
            for (auto i: adj[S])
            {
                y++;
            }
            return y;
        }
};
int main()
{
    int M,N;
    int pom1,pom2,pom3;
    int R=0;
    cin>>N;
    cin>>M;
    int dru[N];
    Graph g(N+1);
    for(int i=1;i<N+1;i++)
    {
        cin>>dru[i];
    }
    for(int i=1;i<M+1;i++)
    {
        cin>>pom1;
        cin>>pom2;
        g.addEdge(pom1,pom2);
    }
    for(int i=1;i<N+1;i++)
    {
        pom3 = g.povez(i);
        R=R+(dru[i]* pom3);
    }
    cout<<R;
    return 0;
}