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>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n) for (int i=1;i <=int(n);i++)
#define rrep(i,n) for(int i= int(n);i>=1;i--)
#define ffor(i,n) for (int i=0;i <int(n);i++)
int a[100005]; int lp[100005];int last[100005];int pre[100005][35];
int tree[1000009];
void upd(int i,int l,int r,int id, int val){
     if (l == r){
          tree[i]=max(tree[i],val);
          return;
     }
     int mid=(l+r)/2;
     if (id <= mid){
          upd(i*2,l,mid,id,val);
     }
     else {
          upd(i*2+1,mid+1,r,id,val);
     }
     tree[i]=max(tree[i*2],tree[i*2+1]);
}
int  get(int i, int l,int r,int ll, int  rr){
     if (r  < ll || l > rr ) return 0;
     if (ll <= l && r <= rr) {
          return tree[i];
     }
     int mid=(l+r)/2;
     return max(get(i*2,l,mid,ll,rr), get(i*2+1,mid+1,r,ll,rr));
     
}
int main(){
     
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     
     
     vector<int> pr;

     for (int i=2; i<=100001; ++i) {
         if (lp[i] == 0) {
             lp[i] = i;
             pr.push_back (i);
         }
         for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=100001; ++j)
             lp[i * pr[j]] = pr[j];
     }
     int n ; cin >> n; int q ; cin >> q;
     rep(i,n) cin >> a[i];
     rep(i,n){
        
          vector<int> pp;
          int val = a[i];
          while (val > 1){
               int now = lp[val];
               pp.pb(now);
              
              while (val % now == 0) val /= now;
          }
          
          int res = 0;
         
          for (auto ii : pp){
              
               res = max(res,last[ii]);
               last[ii] = i;
               
          }
          upd(1,1,n,i,res);
          int ress = get(1,1,n,0,n);
         
          pre[i][0] = ress;
     }
     for (int i = n ; i >=1 ;i--){
          
     }
     rep(t,32){
          rep(i,n){
               pre[i][t] = pre[pre[i][t-1]][t-1];
          }
     }
    // rep(i,n) cout << pre[i][0] << ' ';
     rep(i,q){
          int l,r ; cin >> l >> r;
          int rr = n,ll = 0 ;
          while (ll <= rr){
               int mid = (ll + rr)/2;
               int now = r;
               ffor(t,32) if (mid & (1<<t)) now = pre[now][t];
               if (now < l ) rr = mid-1;else ll = mid+1;
          }
          cout << ll << '\n';
     }
     
               
      
return 0;
}

 //check for bounds