

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;


public class ACC_DFS {

	static double[] enjoyment;	
	static List<List<Integer>> connections;
	
	static double[] maxima;
	static Stack<Integer> s;
	
	static int[] pushed;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt(); int m = sc.nextInt();
		
		enjoyment = new double[n];
		connections = new ArrayList<List<Integer>>(n);
		
		maxima = new double[n];		
		pushed = new int[n];
		
		for(int i = 0; i < n; i++)
		{
			connections.add(new ArrayList<Integer>());
			pushed[i] = 0;
		}
			
		
		for(int i = 0; i < n; i++)
			enjoyment[i] = sc.nextDouble();
		for(int j = 0; j < m; j++)
		{
			int s = sc.nextInt(); int t = sc.nextInt();
			connections.get(s).add(t);
		}
		for(int i = 0; i < n; i++)
			maxima[i] = -1;
		
		// pushed:
		// 0: not seen yet
		// 1: pushed
		// 2: pushed children
		// 3: processed
		
		s = new Stack<Integer>();
		s.add(0);
		pushed[0] = 1;
		while(!s.isEmpty())
		{
			int a = s.pop();
			if(pushed[a] == 2) // We have visited this node, but it isn't fully processed yet i.e. we're on our way back.
			{
				pushed[a] = 3;
				maxima[a] = enjoyment[a];
				for(int c: connections.get(a))
				{
					maxima[a] = Math.max(maxima[a], maxima[c]); // We skip pizza stand a and go to stand c.
					maxima[a] = Math.max(maxima[a], 0.5 * maxima[c] + enjoyment[a]); // We consume delicious pizza at stand a and go to stand c.
				}
			}
			else // We've not seen this node yet. We add it again to the stack and add all its children.
			{
				pushed[a] = 2;
				s.add(a);
				for(int c: connections.get(a))
					if(pushed[c] == 0){
						s.add(c);
						pushed[c] = 1;
					}
			}
			
			
		}
		System.out.println(maxima[0]);
	}
	

}
