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.io.*;
import java.util.*;

public class E {
    class FastReader {
        BufferedReader br;
        StringTokenizer tokenizer;

        FastReader(InputStream inputStream) throws IOException {
            br = new BufferedReader(new InputStreamReader(inputStream));
            tokenizer = new StringTokenizer(br.readLine());
        }

        FastReader(File file) throws IOException {
            this(new FileInputStream(file));
        }

        String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                String line = br.readLine();
                if (line == null) {
                    return null;
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
    }

    public static void main(String... args) throws IOException {
        new E().solve();
    }

    List<Integer> getDividers(int n) {
        List<Integer> dividers = new ArrayList<>();
        for (int d = 2; d < Math.sqrt(n) + 1; d++) {
            while (n % d == 0) {
                dividers.add(d);
                n /= d;
            }
        }
        if (n != 1) {
            dividers.add(n);
        }
        return dividers;
    }

    class BiGraph {
        List<List<Integer>> lEdges;
        List<List<Integer>> rEdges;
        int[] lMarks;
        int[] rMarks;

        BiGraph(int lSize, int rSize) {
            lEdges = new ArrayList<>(lSize);
            for (int i = 0; i < lSize; i++) {
                lEdges.add(new ArrayList<>());
            }
            rEdges = new ArrayList<>(rSize);
            for (int i = 0; i < rSize; i++) {
                rEdges.add(new ArrayList<>());
            }
        }

        void addEdge(int a, int b) {
            lEdges.get(a).add(b);
            rEdges.get(b).add(a);
        }

        List<Integer> findChain(int v, boolean[] rVisited) {
            for (int to : lEdges.get(v)) {
                if (rVisited[to]) {
                    continue;
                }
                if (rMarks[to] == -1) {
                    List<Integer> chain = new ArrayList<>();
                    chain.add(to);
                    chain.add(v);
                    return chain;
                } else {
                    rVisited[to] = true;
                    List<Integer> chain = findChain(rMarks[to], rVisited);
                    if (chain != null) {
                        chain.add(to);
                        chain.add(v);
                        return chain;
                    }
                }
            }
            return null;
        }

        int maxMatchingSize() {
            lMarks = new int[lEdges.size()];
            rMarks = new int[rEdges.size()];
            Arrays.fill(lMarks, -1);
            Arrays.fill(rMarks, -1);
            boolean[] rVisited = new boolean[rMarks.length];
            int ans = 0;
            for (int i = 0; i < lEdges.size(); i++) {
                Arrays.fill(rVisited, false);
                List<Integer> chain = findChain(i, rVisited);
                if (chain != null) {
                    for (Iterator<Integer> it = chain.iterator(); it.hasNext(); ) {
                        int b = it.next();
                        int a = it.next();
                        lMarks[a] = b;
                        rMarks[b] = a;
                    }
                    ans++;
                }
            }
            return ans;
        }
    }

    void solve() throws IOException {
        FastReader reader = new FastReader(System.in);
        PrintWriter writer = new PrintWriter(System.out);
        int n = reader.nextInt();
        int m = reader.nextInt();
        List<List<Integer>> dividers = new ArrayList<>();
        List<Integer> sizeSum = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            dividers.add(getDividers(a));
            if (i > 1) {
                int size = sizeSum.get(i - 2) + dividers.get(i - 2).size();
                sizeSum.add(size);
            } else {
                sizeSum.add(0);
            }
        }
        int lSize = 0;
        int rSize = 0;
        if ((n - 1) % 2 == 0) {
            lSize = sizeSum.get(n - 1) + dividers.get(n - 1).size();
            rSize = sizeSum.get(n - 2) + dividers.get(n - 2).size();
        } else {
            lSize = sizeSum.get(n - 2) + dividers.get(n - 2).size();
            rSize = sizeSum.get(n - 1) + dividers.get(n - 1).size();
        }
        BiGraph graph = new BiGraph(lSize, rSize);
        for (int i = 0; i < m; i++) {
            int a = reader.nextInt() - 1;
            int b = reader.nextInt() - 1;
            if (a % 2 != 0) {
                int temp = a;
                a = b;
                b = temp;
            }
            int aOff = sizeSum.get(a);
            int bOff = sizeSum.get(b);
            int as = dividers.get(a).size();
            int bs = dividers.get(b).size();
            for (int ai = 0; ai < as; ai++) {
                for (int bi = 0; bi < bs; bi++) {
                    if (dividers.get(a).get(ai).equals(dividers.get(b).get(bi))) {
                        graph.addEdge(aOff + ai, bOff + bi);
                    }
                }
            }
        }
        writer.println(graph.maxMatchingSize());
        writer.close();
    }
}
