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
#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[101];
int edge[101][2];
int len_graph[101];
int graph[103][100];
bool prime[32001];
int cnt[101];
int cap[103][103];
int rsd[103][103];
int path[103];
bool flag[103];
bool has_aug_path(int from, int to, int path[], int &len_path) {
  path[len_path++] = from;
  if (from == to) return true;
  if (flag[from]) {
    len_path--;
    return false;
  }
  flag[from] = true;
  for (int i = 0; i < len_graph[from]; i++) {
    int target = graph[from][i];
    if (rsd[from][target] > 0 && has_aug_path(target, to, path, len_path))
      return true;
  }
  len_path--;
  return false;
}
int max_flow(int from, int to) {
  int len_path = 0;
  int res = 0;
  for (int i = 1; i <= n + 2; i++) flag[i] = false;
  while (has_aug_path(from, to, path, len_path)) {
    int min = rsd[path[0]][path[1]];
    for (int i = 2; i < len_path; i++)
      if (rsd[path[i - 1]][path[i]] < min) min = rsd[path[i - 1]][path[i]];
    res += min;
    for (int i = 1; i < len_path; i++) {
      rsd[path[i - 1]][path[i]] -= min;
      rsd[path[i]][path[i - 1]] += min;
    }
    for (int i = 1; i <= n + 2; i++) flag[i] = false;
    len_path = 0;
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) len_graph[i] = 0;
  for (int i = 1; i <= m; i++) {
    int from, to;
    cin >> from >> to;
    if (to % 2) swap(from, to);
    edge[i][0] = from;
    edge[i][1] = to;
    graph[from][len_graph[from]++] = to;
    graph[to][len_graph[to]++] = from;
  }
  for (int i = 1; i <= n; i++)
    if (i % 2) {
      graph[n + 1][len_graph[n + 1]++] = i;
      graph[i][len_graph[i]++] = n + 1;
    } else {
      graph[i][len_graph[i]++] = n + 2;
      graph[n + 2][len_graph[n + 2]++] = i;
    }
  for (int i = 2; i <= 32000; i++) prime[i] = true;
  for (int i = 2; i <= 200; i++)
    if (prime[i])
      for (int j = i * i; j <= 32000; j += i) prime[j] = false;
  for (int i = 1; i <= n + 2; i++)
    for (int j = 1; j <= n + 2; j++) cap[i][j] = rsd[i][j] = 0;
  int res = 0;
  for (int p = 2; p <= 32000; p++)
    if (prime[p]) {
      for (int i = 1; i <= n; i++) cnt[i] = 0;
      for (int i = 1; i <= n; i++)
        while (a[i] % p == 0) {
          cnt[i]++;
          a[i] /= p;
        }
      for (int i = 1; i <= m; i++) {
        int from = edge[i][0];
        int to = edge[i][1];
        cap[from][to] = min(cnt[from], cnt[to]);
        rsd[from][to] = cap[from][to];
        rsd[to][from] = 0;
      }
      for (int i = 1; i <= n; i += 2) {
        cap[n + 1][i] = cnt[i];
        rsd[n + 1][i] = cap[n + 1][i];
        rsd[i][n + 1] = 0;
      }
      for (int i = 2; i <= n; i += 2) {
        cap[i][n + 2] = cnt[i];
        rsd[i][n + 2] = cap[i][n + 2];
        rsd[n + 2][i] = 0;
      }
      res += max_flow(n + 1, n + 2);
    }
  set<int> work_list;
  for (int i = 1; i <= n; i++)
    if (a[i] != 1) work_list.insert(a[i]);
  for (set<int>::iterator it = work_list.begin(); it != work_list.end(); it++) {
    int p = *it;
    for (int i = 1; i <= n; i++) cnt[i] = 0;
    for (int i = 1; i <= n; i++)
      while (a[i] % p == 0) {
        cnt[i]++;
        a[i] /= p;
      }
    for (int i = 1; i <= m; i++) {
      int from = edge[i][0];
      int to = edge[i][1];
      cap[from][to] = min(cnt[from], cnt[to]);
      rsd[from][to] = cap[from][to];
      rsd[to][from] = 0;
    }
    for (int i = 1; i <= n; i += 2) {
      cap[n + 1][i] = cnt[i];
      rsd[n + 1][i] = cap[n + 1][i];
      rsd[i][n + 1] = 0;
    }
    for (int i = 2; i <= n; i += 2) {
      cap[i][n + 2] = cnt[i];
      rsd[i][n + 2] = cap[i][n + 2];
      rsd[n + 2][i] = 0;
    }
    res += max_flow(n + 1, n + 2);
  }
  cout << res << endl;
  return 0;
}
