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:
// Problem: D. Cut
// Contest: Codeforces - Codeforces Round #717 (Div. 2)
// URL: https://codeforces.com/contest/1516/problem/D
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());int get_rand(int l, int r){uniform_int_distribution<int> uid(l,r);return uid(rng);}
vector<ll> Fac(1,1);int Last_Index = 0;
ll nCr(ll n,ll r,ll m){if(r>n) return 0;if(n>Last_Index){for(ll i=Last_Index+1;i<=n;++i){Fac.push_back(Fac[i-1]*i);Fac[i]%=m;}Last_Index=n;}return (((Fac[n]*power(Fac[r],m-2,m))%m)*power(Fac[n-r],m-2,m))%m;}ll gcd(ll a, ll b) {return (b ? gcd(b, a % b) : a);}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
int Google_Test;
int block;
void solve()
{
	// cout << "Case #" << ++Google_Test << ": ";
	int n,q;
	cin >> n >> q;
	int logn = log(n)/log(2) + 1;
	vector<vector<int>> v(1e5+1);
	vector<int> input(n),vis(1e5+1);
	vector<int> check(n,n+1);
	for(int i=0;i<n;++i)
	{
		cin >> input[i];
		v[input[i]].push_back(i);
	}
	for(int i=2;i<=1e5;++i)
	{
		vector<int> index;
		if(!vis[i])
		{
			for(int j=i;j<=1e5;j+=i)
			{
				vis[j] = 1;
				for(int t:v[j])
				index.push_back(t);
			}
		}
		sort(index.begin(),index.end());
		for(int j=0;j<(int)index.size()-1;++j)
		{
			check[index[j]] = min(check[index[j]],index[j+1]);
		}
	}
	for(int i=n-2;i>=0;--i)
	{
		check[i] = min(check[i+1],check[i]);
	}
	vector<vector<int>> dp(n,vector<int>(logn+1));
	for(int i=0;i<=logn;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(i==0)
			{
				dp[j][i] = check[j];
				continue;
			}
			if(dp[j][i-1]==n+1)
			dp[j][i] = n+1;
			else
			dp[j][i] = dp[dp[j][i-1]][i-1];
		}
	}
	for(int i=0;i<q;++i)
	{
		int l,r,ans=0;
		cin >> l >> r;
		--l;
		--r;
		for(int j=logn;j>=0;--j)
		{
			if(dp[l][j]<=r)
			{
				ans+=(1<<j);
				l = dp[l][j];
			}
		}
		cout << ans+1 << endl;
	}
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}