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 JAVA):

Solution:
import java.io.PrintWriter;
import java.util.*;

public class D {

    static Scanner sc;
    static PrintWriter out;

    public static void main(String[] args) throws Exception {

        sc = new Scanner(System.in);
        out = new PrintWriter(System.out);
        //int t = sc.nextInt();
        for(int i=0; i<1; i++) {
            solve();
        }
        out.flush();
    }


    static void solve() {
        int n = sc.nextInt();
        int q = sc.nextInt();
        int[] a = new int[n];
        Arrays.setAll(a, i -> Integer.parseInt(sc.next()));
        Set<Integer>[] set = new Set[100001];
        int[] md = new int[100001];
        Arrays.setAll(md, i->i);
        for(int i=2; i*i<=100000; i++) {
            if(md[i] != i) continue;
            for(int j=2; i*j<=100000; j++) {
                md[i*j] = i;
            }
        }
        set[1] = new HashSet<>();
        for(int i=2; i<=100000; i++) {
            if(md[i] == i) {
                set[i] = new HashSet<>();
                set[i].add(i);
            } else {
                int j = i/md[i];
                set[i] = new HashSet<>();
                set[i].addAll(set[j]);
                set[i].add(md[i]);
            }
        }
        int inf = n;
        int[] next = new int[n];
        Arrays.fill(next, inf);
        int[] c = new int[100001];
        for(int num : set[a[0]]) {
            c[num]++;
        }
        int l=0;
        int r=0;
        int bad = 0;
        while(l<n) {
            while(bad == 0 && r<n) {
                r++;
                if (r < n) {
                    for (int num : set[a[r]]) {
                        c[num]++;
                        if (c[num] == 2)
                            bad++;
                    }
                }
            }
            if(bad == 0) break;
            next[l] = r-1;
            while(bad > 0 && l<n) {
                for (int num : set[a[l]]) {
                    c[num]--;
                    if (c[num] == 1)
                        bad--;
                }
                l++;
                if(l<n && bad>0) next[l] = r-1;
            }
        }

        int[][] jump = new int[20][n+1];
        for(int i=0; i<n; i++) {
            if(next[i]==inf) {
                jump[0][i] = inf;
            } else {
                jump[0][i] = next[i]+1;
            }
        }
        jump[0][n] = n;
        for(int j=0; j+1<20; j++) {
            for(int i=0; i<n; i++) {
                jump[j+1][i] = jump[j][jump[j][i]];
            }
            jump[j+1][n] = n;
        }

        for(int i=0; i<q; i++) {
            int ll = sc.nextInt()-1;
            int rr = sc.nextInt()-1;
            int p = 0;
            if(jump[0][ll] > rr) {
                out.println(1);
                continue;
            }
            while(jump[p][ll] <= rr) {
                p++;
            }
            p--;
            int pos = ll;
            int res = 1;
            while(pos <= rr && p>=0) {
                if(jump[p][pos] <= rr) {
                    res += 1<<p;
                    pos = jump[p][pos];
                } else {
                    p--;
                }
            }
            out.println(res);


        }



    }


    static int[] primes(int max) {
        boolean[] isp = isprime(max);
        int count = 0;
        for(boolean b : isp) {
            if(b) count++;
        }
        int[] res = new int[count];
        int pos = 0;
        for(int i=2; i<=max; i++) {
            if(isp[i]) res[pos++] = i;
        }
        return res;
    }
    static boolean[] isprime(int max) {
        boolean[] b = new boolean[max+1];
        Arrays.fill(b, true);
        b[0] = false;
        b[1] = false;
        for(int i=2; i*i<=max; i++) {
            if(!b[i]) continue;
            for(int j=2; j*i<=max; j++) {
                b[i*j] = false;
            }
        }
        return b;
    }



}