You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), (i2, j2), ..., (im, jm). Each good pair (ik, jk) meets the following conditions: ik + jk is an odd number and 1 ≤ ik < jk ≤ n.

In one operation you can perform a sequence of actions: 

  * take one of the good pairs (ik, jk) and some integer v (v > 1), which divides both numbers a[ik] and a[jk]; 
  * divide both numbers by v, i. e. perform the assignments: <image> and <image>. 



Determine the maximum number of operations you can sequentially perform on the given array. Note that one pair may be used several times in the described operations.

Input

The first line contains two space-separated integers n, m (2 ≤ n ≤ 100, 1 ≤ m ≤ 100).

The second line contains n space-separated integers a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109) — the description of the array.

The following m lines contain the description of good pairs. The k-th line contains two space-separated integers ik, jk (1 ≤ ik < jk ≤ n, ik + jk is an odd number).

It is guaranteed that all the good pairs are distinct.

Output

Output the answer for the problem.

Examples

Input

3 2
8 3 8
1 2
2 3


Output

0


Input

3 2
8 12 8
1 2
2 3


Output

2
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class MainE {
	
	static int n;
	static int m;
	static int[] nums;
	static int[][] fromTo;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		nums = new int[n];
		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		fromTo = new int[m][2];
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a % 2 == 1) {
				fromTo[i][0] = a;
				fromTo[i][1] = b;
			} else {
				fromTo[i][0] = b;
				fromTo[i][1] = a;
			}
		}
		sc.close();
		int ans = 0;
		List<Integer> primes = sieveEratosthene(40000);
		for (int prime : primes) {
			ans += solve(prime);
		}
		for (int i = 0; i < n; i++) {
			if (nums[i] > 1) {
				ans += solve(nums[i]);
			}
		}
		System.out.println(ans);
	}
	
	private static int solve(int divisor) {
		DirectedGraph graph = new DirectedGraph(n + 2);
		int[] capacity = new int[n];
		for (int i = 0; i < n; i++) {
			while (nums[i] % divisor == 0) {
				nums[i] /= divisor;
				capacity[i]++;
			}
			if (capacity[i] > 0) {
				if (i % 2 == 0) {
					graph.addEdge(0, i + 1, capacity[i]);
				} else {
					graph.addEdge(i + 1, n + 1, capacity[i]);
				}
			}
		}
		for (int i = 0; i < m; i++) {
			int from = fromTo[i][0];
			int to = fromTo[i][1];
			if (capacity[from - 1] > 0 && capacity[to - 1] > 0) {
				graph.addEdge(from, to, Integer.MAX_VALUE);
			}
		}
		Vertex source = graph.vertices.get(0);
		Vertex sink = graph.vertices.get(n + 1);
		return graph.maxFlow(source, sink);
	}
	
	private static List<Integer> sieveEratosthene(int limit) {
		List<Integer> list = new ArrayList<>(limit - 1);
		for (int i = 2; i <= limit; i++) {
			list.add(i);
		}
		List<Integer> primes = new ArrayList<>();
		while (!list.isEmpty()) {
			int p = list.get(0);
			primes.add(p);
			List<Integer> newList = new ArrayList<>(list.size());
			for (Integer i : list) {
				if (i % p != 0) {
					newList.add(i);
				}
			}
			list = newList;
		}
		return primes;
	}
		
	static class DirectedGraph {
		List<Vertex> vertices;
		public DirectedGraph(int num) {
			vertices = new ArrayList<>(num);
			for (int i = 0; i < num; i++) {
				vertices.add(new Vertex(i));
			}
		}
		public void addEdge(int from, int to, int capacity) {
			vertices.get(from).addEdge(vertices.get(to), capacity);
		}
		private List<Edge> path;
		private boolean[] searched;
		private boolean findAugmentedPath(Vertex v, Vertex sink) {
			if (v == sink) {
				return true;
			}
			searched[v.key] = true;
			for (Edge e : v.edges) {
				if (e.residual > 0 && !searched[e.to.key]) {
					if (findAugmentedPath(e.to, sink)) {
						path.add(e);
						return true;
					}
				}
			}
			return false;
		}
		private int augmentedPathFlow() {
			int flow = Integer.MAX_VALUE;
			for (Edge e : path) {
				flow = Math.min(flow, e.residual);
			}
			for (Edge e : path) {
				e.residual -= flow;
				e.reverse.residual += flow;
			}
			return flow;
		}
		public int maxFlow(Vertex source, Vertex sink) {
			int flow = 0;
			path = new ArrayList<>();
			searched = new boolean[vertices.size()];
			while (findAugmentedPath(source, sink)) {
				flow += augmentedPathFlow();
				path = new ArrayList<>();
				searched = new boolean[vertices.size()];
			}
			return flow;
		}
	}

	static class Vertex {
		int key;
		List<Edge> edges;
		public Vertex() {
			edges = new ArrayList<>();
		}
		public Vertex(int key) {
			this.key = key;
			edges = new ArrayList<>();
		}
		public void addEdge(Vertex to, int capacity) {
			Edge e1 = new Edge(this, to, capacity);
			Edge e2 = new Edge(to, this, 0);
			e1.reverse = e2;
			e2.reverse = e1;
			edges.add(e1);
			to.edges.add(e2);
		}
	}
	
	static class Edge {
		Vertex from, to;
		int capacity, flow, residual;
		Edge reverse;
		public Edge(Vertex from, Vertex to, int capacity) {
			this.from = from;
			this.to = to;
			this.capacity = capacity;
			residual = capacity;
			flow = 0;
		}
	}
}