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 (*i*<sub class="lower-index">1</sub>, *j*<sub class="lower-index">1</sub>), (*i*<sub class="lower-index">2</sub>, *j*<sub class="lower-index">2</sub>), ..., (*i*<sub class="lower-index">*m*</sub>, *j*<sub class="lower-index">*m*</sub>). Each good pair (*i*<sub class="lower-index">*k*</sub>, *j*<sub class="lower-index">*k*</sub>) meets the following conditions: *i*<sub class="lower-index">*k*</sub> + *j*<sub class="lower-index">*k*</sub> is an odd number and 1 ≤ *i*<sub class="lower-index">*k*</sub> &lt; *j*<sub class="lower-index">*k*</sub> ≤ *n*.

In one operation you can perform a sequence of actions: 
 -  take one of the good pairs (*i*<sub class="lower-index">*k*</sub>, *j*<sub class="lower-index">*k*</sub>) and some integer *v* (*v* &gt; 1), which divides both numbers *a*[*i*<sub class="lower-index">*k*</sub>] and *a*[*j*<sub class="lower-index">*k*</sub>]; -  divide both numbers by *v*, i. e. perform the assignments: <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/192b5056ddf57cd3030615790d2a21051c01bc9d.png" style="max-width: 100.0%;max-height: 100.0%;"/> and <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/f143c28d601c34862d9b5035284c5bde440a0e3d.png" style="max-width: 100.0%;max-height: 100.0%;"/>. 
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.
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*] ≤ 10<sup class="upper-index">9</sup>) — the description of the array.

The following *m* lines contain the description of good pairs. The *k*-th line contains two space-separated integers *i*<sub class="lower-index">*k*</sub>, *j*<sub class="lower-index">*k*</sub> (1 ≤ *i*<sub class="lower-index">*k*</sub> &lt; *j*<sub class="lower-index">*k*</sub> ≤ *n*, *i*<sub class="lower-index">*k*</sub> + *j*<sub class="lower-index">*k*</sub> is an odd number).

It is guaranteed that all the good pairs are distinct.
from math import gcd
from collections import deque
def lcm(a, b):
    return a * b // gcd(a, b)
def aze(d):
	ans=0
	while d%2==0:
		d//=2
		ans+=1
	i=3
	while d!=1:
		while d%i==0:
			ans+=1
			d//=i
		i+=2
	return(ans)

n,m=map(int,input().split())
a=list(map(int,input().split()))
graph=[[0 for i in range(n+2)] for i in range(n+2)]


for _ in range(m):
	i,j=map(int,input().split())
	g=gcd(a[i-1],a[j-1])
	graph[i][j]=g
	graph[j][i]=g
for i in range(1,n+1):
	
	if i%2==0:
		c=1
		for j in range(1,n+1):
			if graph[i][j]!=0:
				c=lcm(c,graph[i][j])
		graph[0][i]=c
	else:
		c=1
		for j in range(1,n+1):
			if graph[i][j]!=0:
				c=lcm(c,graph[i][j])
				graph[i][j]=0
		graph[i][n+1]=c

for i in range(n+2):
	for j in range(n+2):
		if graph[i][j]!=0:
			graph[i][j]=aze(graph[i][j])


def BFS(graph, s, t, parent):
    # Return True if there is node that has not iterated.
	visited = [False] * len(graph)
	queue = []
	queue.append(s)
	visited[s] = True

	while queue:
		u = queue.pop(0)
		for ind in range(len(graph[u])):
			if visited[ind] is False and graph[u][ind] > 0:
				queue.append(ind)
				visited[ind] = True
				parent[ind] = u

	return True if visited[t] else False


def FordFulkerson(graph, source, sink):
    # This array is filled by BFS and to store path
	parent = [-1] * (len(graph))
	max_flow = 0
	while BFS(graph, source, sink, parent):
		path_flow = float("Inf")
		s = sink

		while s != source:
            # Find the minimum value in select path
			path_flow = min(path_flow, graph[parent[s]][s])
			s = parent[s]

		max_flow += path_flow
		v = sink

		while v != source:
			u = parent[v]
			graph[u][v] -= path_flow
			graph[v][u] += path_flow
			v = parent[v]
	return max_flow

print(FordFulkerson(graph,0,n+1))