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;
bool debug = 1;
struct Edge {
  int v, u;
  long long capacity, flow = 0;
  Edge(int v, int u, long long capacity) : v(v), u(u), capacity(capacity) {}
};
struct Dinic {
  const long long flow_inf = 1e18;
  vector<Edge> edges;
  vector<vector<int>> adjList;
  int n, e = 0;
  int src, dst;
  vector<int> level, ptr;
  queue<int> mq;
  Dinic(int n) : n(n) {
    adjList.resize(n);
    level.resize(n);
    ptr.resize(n);
  }
  void addEdge(int v, int u, long long capacity) {
    edges.emplace_back(v, u, capacity);
    edges.emplace_back(u, v, 0);
    adjList[v].push_back(e++);
    adjList[u].push_back(e++);
  }
  bool bfs() {
    while (!mq.empty()) {
      int v = mq.front();
      mq.pop();
      for (int id : adjList[v]) {
        if (edges[id].capacity - edges[id].flow < 1) continue;
        if (level[edges[id].u] != -1) continue;
        level[edges[id].u] = level[v] + 1;
        mq.push(edges[id].u);
      }
    }
    return level[dst] != -1;
  }
  long long dfs(int v, long long pushed) {
    if (pushed == 0) return 0;
    if (v == dst) return pushed;
    for (int& cid = ptr[v]; cid < (int)adjList[v].size(); cid++) {
      int id = adjList[v][cid];
      int u = edges[id].u;
      if (level[v] + 1 != level[u] || edges[id].capacity - edges[id].flow < 1)
        continue;
      long long tr = dfs(u, min(pushed, edges[id].capacity - edges[id].flow));
      if (tr == 0) continue;
      edges[id].flow += tr;
      edges[id ^ 1].flow -= tr;
      return tr;
    }
    return 0;
  }
  long long maxFlow(int src, int dst) {
    this->src = src;
    this->dst = dst;
    long long f = 0;
    while (true) {
      fill(level.begin(), level.end(), -1);
      level[src] = 0;
      mq.push(src);
      if (!bfs()) break;
      fill(ptr.begin(), ptr.end(), 0);
      while (long long pushed = dfs(src, flow_inf)) {
        f += pushed;
      }
    }
    return f;
  }
  vector<Edge> getUsedCapacity() {
    vector<Edge> used;
    for (Edge e : edges) {
      if (e.flow > 0) used.push_back(e);
    }
    return used;
  }
};
int nodeNum = 1;
vector<pair<pair<int, int>, int>> primeFactors(int n) {
  map<int, int> primeCount;
  while (n % 2 == 0) {
    primeCount[2]++;
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      primeCount[i]++;
      n = n / i;
    }
  }
  if (n > 2) primeCount[n]++;
  vector<pair<pair<int, int>, int>> primes;
  for (pair<int, int> itr : primeCount) {
    primes.push_back({itr, nodeNum++});
  }
  return primes;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<pair<int, int>> pairs;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    if (u % 2 == 0) {
      pairs.push_back({u, v});
    } else {
      pairs.push_back({v, u});
    }
  }
  vector<vector<pair<pair<int, int>, int>>> primeGroups;
  for (int i = 0; i < n; i++) {
    primeGroups.push_back(primeFactors(arr[i]));
  }
  int src = 0;
  int dst = nodeNum;
  Dinic graph = Dinic(dst + 1);
  for (int i = 0; i < n; i += 2) {
    for (auto itr : primeGroups[i]) {
      graph.addEdge(src, itr.second, itr.first.second);
    }
  }
  for (int i = 0; i < m; i++) {
    for (auto itr1 : primeGroups[pairs[i].first]) {
      for (auto itr2 : primeGroups[pairs[i].second]) {
        if (itr1.first.first == itr2.first.first) {
          graph.addEdge(itr1.second, itr2.second, 2e9);
        }
      }
    }
  }
  for (int i = 1; i < n; i += 2) {
    for (auto itr : primeGroups[i]) {
      graph.addEdge(itr.second, dst, itr.first.second);
    }
  }
  cout << graph.maxFlow(src, dst) << endl;
  return 0;
}
