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

namespace TakProg2
{
    struct osoba { public int s; public int bp; }
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            osoba[] a = new osoba[n];
            for (int i = 0; i < n; i++)
                a[i].s = int.Parse(Console.ReadLine());
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                int o1 = int.Parse(s[0]);
                int o2 = int.Parse(s[1]);
                a[o1 - 1].bp++;
                a[o2 - 1].bp++;
            }
            int sr = 0;
            for (int i = 0; i < n; i++)
                sr += a[i].s * a[i].bp;
            Console.WriteLine(sr);
        }
    }
}