Problem: This time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the following:

  * he picks a range (l, r) and cuts the subsegment a_l, a_{l + 1}, …, a_r out, removing the rest of the array. 
  * he then cuts this range into multiple subranges. 
  * to add a number theory spice to it, he requires that the elements of every subrange must have their product equal to their [least common multiple (LCM)](https://en.wikipedia.org/wiki/Least_common_multiple). 



Formally, he partitions the elements of a_l, a_{l + 1}, …, a_r into contiguous subarrays such that the product of every subarray is equal to its LCM. Now, for q independent ranges (l, r), tell Baby Ehab the minimum number of subarrays he needs.

Input

The first line contains 2 integers n and q (1 ≤ n,q ≤ 10^5) — the length of the array a and the number of queries.

The next line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^5) — the elements of the array a.

Each of the next q lines contains 2 integers l and r (1 ≤ l ≤ r ≤ n) — the endpoints of this query's interval.

Output

For each query, print its answer on a new line.

Example

Input


6 3
2 3 10 7 5 14
1 6
2 4
3 5


Output


3
1
2

Note

The first query asks about the whole array. You can partition it into [2], [3,10,7], and [5,14]. The first subrange has product and LCM equal to 2. The second has product and LCM equal to 210. And the third has product and LCM equal to 70. Another possible partitioning is [2,3], [10,7], and [5,14].

The second query asks about the range (2,4). Its product is equal to its LCM, so you don't need to partition it further.

The last query asks about the range (3,5). You can partition it into [10,7] and [5].

Solution (in CPP):

Solution:
#include "bits/stdc++.h"
/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
//ordered_set p; 
//p.find_by_order(3)
//p.order_of_key(6)
*/
//#include <algorithm>
#define sz(x)             (int)((x).size())
#define int long long
#define ll long long 
#define mod 1000000007
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define umap unordered_map
#define uset unordered_set
#define lb lower_bound
#define ub upper_bound
#define endll "\n";
#define all(x) (x).begin(), (x).end()
#define forr(it,x) for(auto it=x.begin();it!=x.end();it++)
#define for1(i,a,b) for(int i=a;i<b;i++)
#define for2(i,a,b) for(int i=a;i>=b;i--)
#define for3(i,a,b) for(long long int i=a;i<b;i++)
#define for4(i,a,b) for(long long int i=a;i>=b;i--)
#define pp pair<int,int>
#define ld long double
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpp vector<pp>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvpp vector<vpp>
#define I insert
#define mem(a,x) memset(a,x,sizeof(a))
#define p_queue(a) priority_queue<a,vector<a>,greater<a>>
using namespace std;
//const int dx[8]={1,0,-1,0,1,1,-1,-1},dy[8]={0,1,0,-1,-1,1,-1,1};
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1}; 
const int N=1e5+5;
const int INF = 1e9+5;
/*vector<bool> p(N+1, true);
void sieve()
{
  p[0] = p[1] = false;
  int i,j;
  for (i = 2; i*i <= N; i++) 
  {
      if (p[i]) 
      {
          for (j = i * i; j <=N; j += i)
            {
        p[j] =false;
        }
      }
  }
}*/
/*ll power(ll a1, ll b1){
    ll res = 1;
    while(b1 > 0){
        if(b1 % 2){
            res = 1LL * res * a1 % mod;
        }
        a1 = 1LL * a1 * a1 % mod;
        b1 /= 2;
    }
    return res;
}
ll invmod(ll a1,ll b1){
  return power(a1,b1-2);
}*/
/*ll ncr(int n1,int c1){
  if(n1<c1)
    return 0;
  if(n1==c1||c1==0)
    return 1;
  ll n=n1,c=c1;
  vll fact(n+1,1);
  for1(i,1,n+1){
    fact[i]=fact[i-1];
    fact[i]*=i;
    fact[i]%=mod;
  }
  ll fact1=fact[n];
  ll fact2=fact[c];
  ll fact3=fact[n-c];
  fact1*=invmod(fact2,mod);fact1%=mod;
  fact1*=invmod(fact3,mod);fact1%=mod;
  return fact1;
}*/
int c[N];
void generate(){
  for1(i,1,N) c[i]=i;
  for1(i,2,N){
    if(c[i]==i){
      for(int j=i;j<N;j+=i){
        if(c[j]==j){
          c[j]/=i;
        }
      }
    }
  }
}
vi find1(int n){
  vi ans;
  int ele;
  while(n>1){
     ele=n/c[n];
     n=c[n];
     if(sz(ans)==0||ans.back()!=ele){
       ans.pb(ele);
     }
  }
  return ans;
}
/*int gcd(int a,int b){
    if(a<b) swap(a,b);
    if(b==0) return a;
    a%=b;
    return gcd(b,a);
}*/
/*int lcm(int a,int b){
   return (a*1LL*b)/gcd(a,b);
}*/
int a[N];
vi adj[N];
void dfs(int src,int h,vi &height){
    height[src]=h;
    for(auto x:adj[src]){
      dfs(x,h+1,height);
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    generate();
    int n,q;cin>>n>>q;
    for1(i,1,n+1){
      cin>>a[i];
    }
    vi v1(N,n+1),v2(n+1,n+1);
    for2(i,n,1){
      vi v3=find1(a[i]);
      for(auto x:v3){
        v2[i]=min(v2[i],v1[x]);
        v1[x]=i;
      }
    }
    vi par(n+2,n+1);
    for2(i,n,1){
      par[i]=min(v2[i],par[i+1]);
      adj[par[i]].pb(i);
    }
    int n1=log2(n);
    vvi dp(n+2,vi(n1+1,n+1));
    for1(j,0,n1+1){
      for1(i,1,n+1){
        if(j==0){
          dp[i][j]=par[i];
        }
        else{
           dp[i][j]=dp[dp[i][j-1]][j-1];
        }
      }
    }
    while(q--){
      int ans=0,l,r;cin>>l>>r;
      for2(i,n1,0){
        if(dp[l][i]<=r){
          ans+=(1<<i);
          l=dp[l][i];
        }
      }
      cout<<ans+1<<endll;
    }
    /*vi height(n+2);
   // dfs(n+1,0,height);
    while(q--){
      int l,r;cin>>l>>r;
      cout<<height[l]-height[r]+1<<endll;
    }*/
    return 0;
}

/*

*/