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;
using ll = long long;
using ull = unsigned long long;
const ll mod = 1e9 + 7;
const int inf = 5e6;
const int INF = 1e9;
struct Edge {
  int from, to, cap, flow, index;
  Edge(int from, int to, int cap, int flow, int index)
      : from(from), to(to), cap(cap), flow(flow), index(index) {}
};
struct Dinic {
  int N;
  vector<vector<Edge> > G;
  vector<Edge *> dad;
  vector<int> Q;
  Dinic(int N) : N(N), G(N), dad(N), Q(N) {}
  void add_edge(int from, int to, int cap) {
    G[from].push_back(Edge(from, to, cap, 0, G[to].size()));
    if (from == to) G[from].back().index++;
    G[to].push_back(Edge(to, from, 0, 0, G[from].size() - 1));
  }
  long long blocking_flow(int s, int t) {
    fill(dad.begin(), dad.end(), (Edge *)NULL);
    dad[s] = &G[0][0] - 1;
    int head = 0, tail = 0;
    Q[tail++] = s;
    while (head < tail) {
      int x = Q[head++];
      for (int i = 0; i < G[x].size(); i++) {
        Edge &e = G[x][i];
        if (!dad[e.to] && e.cap - e.flow > 0) {
          dad[e.to] = &G[x][i];
          Q[tail++] = e.to;
        }
      }
    }
    if (!dad[t]) return 0;
    long long totflow = 0;
    for (int i = 0; i < G[t].size(); i++) {
      Edge *start = &G[G[t][i].to][G[t][i].index];
      int amt = INF;
      for (Edge *e = start; amt && e != dad[s]; e = dad[e->from]) {
        if (!e) {
          amt = 0;
          break;
        }
        amt = min(amt, e->cap - e->flow);
      }
      if (amt == 0) continue;
      for (Edge *e = start; amt && e != dad[s]; e = dad[e->from]) {
        e->flow += amt;
        G[e->to][e->index].flow -= amt;
      }
      totflow += amt;
    }
    return totflow;
  }
  long long max_flow(int s, int t) {
    long long totflow = 0;
    while (long long flow = blocking_flow(s, t)) totflow += flow;
    return totflow;
  }
  void clear_flow() {
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < G[i].size(); ++j) G[i][j].flow = 0;
  }
};
const int sz = 5e4 + 10;
int n, m;
vector<int> G[105];
int src, sink;
int tot_v;
vector<int> pr;
bitset<sz> fl;
int fac[sz];
void siv() {
  for (int i = 4; i < sz; i += 2) fl[i] = 1;
  for (int i = 3; i * i < sz; i += 2) {
    if (fl[i]) continue;
    for (int j = i * i; j < sz; j += i) fl[j] = 1;
  }
  pr.push_back(2);
  for (int i = 3; i < sz; i += 2)
    if (fl[i] == 0) pr.push_back(i);
}
void factorise(int i, int num) {
  for (const int x : pr) {
    while (num % x == 0) {
      num /= x;
      tot_v++;
      G[i].push_back(tot_v);
      fac[tot_v] = x;
    }
  }
  if (num > 1) {
    tot_v++;
    G[i].push_back(tot_v);
    fac[tot_v] = num;
  }
}
int main() {
  siv();
  while (cin >> n >> m) {
    tot_v = 0;
    for (int i = 0; i < n; i++) {
      G[i].clear();
      int x;
      cin >> x;
      factorise(i, x);
    }
    src = 0;
    sink = tot_v + 1;
    Dinic graph(sink + 1);
    while (m--) {
      int x, y;
      cin >> x >> y;
      --x, --y;
      if (x & 1) swap(x, y);
      for (const int &u : G[x]) {
        for (const int &v : G[y]) {
          if (fac[u] == fac[v]) graph.add_edge(u, v, 1);
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (const int &u : G[i])
        graph.add_edge(i & 1 ? u : src, i & 1 ? sink : u, 1);
    }
    cout << graph.max_flow(src, sink) << "\n";
    cerr << "-----\n";
  }
  return 0;
}
