using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zadatak2;

namespace Zadatak2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz = Console.ReadLine().Split();
            long a, b;
            long brUcenika = long.Parse(ulaz[0]);
            long brParova = long.Parse(ulaz[1]);
            long[] nizA = new long[brUcenika];
            long[] nizSrece = new long[brUcenika];
            for (int i = 0; i < brUcenika; i++)
            {
                nizA[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < brParova; i++)
            {
                ulaz = Console.ReadLine().Split();
                a = long.Parse(ulaz[0]);
                b = long.Parse(ulaz[1]);
                nizSrece[a - 1]++;
                nizSrece[b - 1]++;
            }
            long ukupnaSreca = 0;
            for (int i = 0; i < brUcenika; i++)
            {
                ukupnaSreca += nizA[i] * nizSrece[i];
            }
            Console.WriteLine(ukupnaSreca);
        }
    }
}