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;
const int MOD = 998244353;
const int N = 1000005;
const double PI = 4 * atan(1);
const double eps = 1e-7;
const long long oo = 1e10;
const int K = 205;
long long _sieve_size;
bitset<10000010> bs;
vector<long long> primes;
void sieve(long long upperbound) {
  _sieve_size = upperbound + 1;
  bs.set();
  bs[0] = bs[1] = 0;
  for (long long i = 2; i <= _sieve_size; i++)
    if (bs[i]) {
      for (long long j = i * i; j <= _sieve_size; j += i) bs[j] = 0;
      primes.push_back((int)i);
    }
}
vector<long long> primeFactors(long long N) {
  vector<long long> factors;
  long long PF_idx = 0, PF = primes[PF_idx];
  while (N != 1 && (PF * PF <= N)) {
    while (N % PF == 0) {
      N /= PF;
      factors.push_back(PF);
    }
    PF = primes[++PF_idx];
  }
  if (N != 1) factors.push_back(N);
  return factors;
}
struct FlowEdge {
  int v, u;
  long long cap, flow = 0;
  FlowEdge(int v, int u, long long cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
  const long long flow_inf = 1e18;
  vector<FlowEdge> edges;
  vector<vector<int>> adj;
  int n, m = 0;
  int second, t;
  vector<int> level, ptr;
  queue<int> q;
  Dinic(int n, int second, int t) : n(n), second(second), t(t) {
    adj.resize(n);
    level.resize(n);
    ptr.resize(n);
  }
  void add_edge(int v, int u, long long cap) {
    edges.emplace_back(v, u, cap);
    edges.emplace_back(u, v, 0);
    adj[v].push_back(m);
    adj[u].push_back(m + 1);
    m += 2;
  }
  bool bfs() {
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (int id : adj[v]) {
        if (edges[id].cap - edges[id].flow < 1) continue;
        if (level[edges[id].u] != -1) continue;
        level[edges[id].u] = level[v] + 1;
        q.push(edges[id].u);
      }
    }
    return level[t] != -1;
  }
  long long dfs(int v, long long pushed) {
    if (pushed == 0) return 0;
    if (v == t) return pushed;
    for (int& cid = ptr[v]; cid < (int)adj[v].size(); cid++) {
      int id = adj[v][cid];
      int u = edges[id].u;
      if (level[v] + 1 != level[u] || edges[id].cap - edges[id].flow < 1)
        continue;
      long long tr = dfs(u, (pushed < edges[id].cap - edges[id].flow
                                 ? pushed
                                 : edges[id].cap - edges[id].flow));
      if (tr == 0) continue;
      edges[id].flow += tr;
      edges[id ^ 1].flow -= tr;
      return tr;
    }
    return 0;
  }
  long long flow() {
    long long first = 0;
    while (true) {
      fill(level.begin(), level.end(), -1);
      level[second] = 0;
      q.push(second);
      if (!bfs()) break;
      fill(ptr.begin(), ptr.end(), 0);
      while (long long pushed = dfs(second, flow_inf)) {
        first += pushed;
      }
    }
    return first;
  }
};
vector<pair<int, int>> rel;
int n, m;
int a[105];
int b[105];
set<long long> ss;
vector<long long> fact[105];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  sieve(100000);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    fact[i] = primeFactors(a[i]);
    for (auto t : fact[i]) {
      ss.insert(t);
    }
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if (x % 2) swap(x, y);
    rel.push_back({x, y});
  }
  long long ans = 0;
  for (auto t : ss) {
    Dinic d = Dinic(n + 2, n, n + 1);
    for (int i = 0; i < n; i++) {
      b[i] = 0;
      long long x = a[i];
      while (x % t == 0) {
        b[i]++;
        x /= t;
      }
      if (b[i]) {
        if (i % 2 == 0) {
          d.add_edge(n, i, b[i]);
        } else {
          d.add_edge(i, n + 1, b[i]);
        }
      }
    }
    for (int i = 0; i < m; i++) {
      d.add_edge(rel[i].first, rel[i].second, 1e7);
    }
    ans += d.flow();
  }
  cout << ans;
  return 0;
}
