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.
# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO,IOBase

def matching(n,m,path):
    match1 = [-1]*n
    match2 = [-1]*m
    for node in range(n):
        for nei in path[node]:
            if match2[nei] == -1:
                match1[node] = nei
                match2[nei] = node
                break
    while 1:
        bfs = [node for node in range(n) if match1[node] == -1]
        depth = [-1] * n
        for node in bfs:
            depth[node] = 0

        for node in bfs:
            for nei in path[node]:
                next_node = match2[nei]
                if next_node == -1:
                    break
                if depth[next_node] == -1:
                    depth[next_node] = depth[node] + 1
                    bfs.append(next_node)
            else:
                continue
            break
        else:
            break
        pointer = [len(c) for c in path]
        dfs = [node for node in range(n) if depth[node] == 0]
        while dfs:
            node = dfs[-1]
            while pointer[node]:
                pointer[node] -= 1
                nei = path[node][pointer[node]]
                next_node = match2[nei]
                if next_node == -1:
                    while nei != -1:
                        node = dfs.pop()
                        match2[nei], match1[node], nei = node, nei, match1[node]
                    break
                elif depth[node] + 1 == depth[next_node]:
                    dfs.append(next_node)
                    break
            else:
                dfs.pop()
    return match1

def fac(x):
    ans = []
    while not x%2:
        x //= 2
        ans.append(2)
    for i in range(3,int(x**0.5)+1,2):
        while not x%i:
            x //= i
            ans.append(i)
    return ans

def main():
    n,m = map(int,input().split())
    a = list(map(lambda xx:fac(int(xx)),input().split()))
    tot = sum(len(a[i]) for i in range(0,n,2))
    st,st1 = [0],[0]
    for i in range(n):
        if not i&1:
            st.append(st[-1]+len(a[i]))
        else:
            st1.append(st1[-1]+len(a[i]))
    path = [[] for _ in range(tot)]
    for _ in range(m):
        u,v = map(lambda xx:int(xx)-1,input().split())
        if u&1:
            u,v = v,u
        for ind,i in enumerate(a[u]):
            for ind1,j in enumerate(a[v]):
                if i == j:
                    path[st[u//2]+ind].append(st[v//2]+ind1)
    match = matching(st[-1],st1[-1],path)
    print(len(match)-match.count(-1))

# Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self,file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd,max(os.fstat(self._fd).st_size,BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0,2),self.buffer.write(b),self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd,max(os.fstat(self._fd).st_size,BUFSIZE))
            self.newlines = b.count(b"\n")+(not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0,2),self.buffer.write(b),self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd,self.buffer.getvalue())
            self.buffer.truncate(0),self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self,file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s:self.buffer.write(s.encode("ascii"))
        self.read = lambda:self.buffer.read().decode("ascii")
        self.readline = lambda:self.buffer.readline().decode("ascii")
sys.stdin,sys.stdout = IOWrapper(sys.stdin),IOWrapper(sys.stdout)
input = lambda:sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
    main()