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:
/*
bts songs to dance to:
I need U
Run
ON
Filter
I'm fine
 */
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;

public class x1516D
{
    static final int MAX = 100000;
    public static void main(String hi[]) throws Exception
    {
        int[] primes = new int[MAX+1];
        for(int v=2; v <= MAX; v++)
            if(primes[v] == 0)
                for(int d=v; d <= MAX; d+=v)
                    primes[d] = v;
        FastScanner infile = new FastScanner();
        int N = infile.nextInt();
        int Q = infile.nextInt();
        int[] arr = infile.nextInts(N);
        //preprocess
        int[] jumps = new int[N];
        int[] prev = new int[MAX+1];
        Arrays.fill(prev, N);
        for(int i=N-1; i >= 0; i--)
        {
            int temp = N;
            int val = arr[i];
            while(val > 1)
            {
                int p = primes[val];
                while(val%p == 0)
                    val /= p;
                temp = min(temp, prev[p]);
                prev[p] = i;
            }
            if(i+1 < N)
                temp = min(temp, jumps[i+1]);
            jumps[i] = temp;
        }
        //dp[i][b] = N if it hits end of array
        int[][] dp = new int[N][17];
        for(int i=0; i < N; i++)
            dp[i][0] = jumps[i];
        for(int b=1; b < 17; b++)
            for(int i=0; i < N; i++)
            {
                int mid = dp[i][b-1];
                if(mid == N)
                    dp[i][b] = N;
                else
                    dp[i][b] = dp[mid][b-1];
            }
        //queries
        StringBuilder sb = new StringBuilder();
        while(Q-->0)
        {
            int left = infile.nextInt()-1;
            int right = infile.nextInt()-1;
            int res = 0;
            int bit = 16;
            while(left <= right)
            {
                while(bit > 0 && dp[left][bit] > right)
                    bit--;
                left = dp[left][bit];
                res += 1<<bit;
            }
            sb.append(res+"\n");
        }
        System.out.print(sb);
    }
}
/*
subarray is good if and only if gcd of any 2 numbers = 1 (coprime)
each number has at most 6 prime factors

binary lifting?
let right[i] = necessary place to split
 */
class FastScanner
{
    private int BS = 1 << 16;
    private char NC = (char) 0;
    private byte[] buf = new byte[BS];
    private int bId = 0, size = 0;
    private char c = NC;
    private double cnt = 1;
    private BufferedInputStream in;

    public FastScanner() {
        in = new BufferedInputStream(System.in, BS);
    }

    public FastScanner(String s) {
        try {
            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
        } catch (Exception e) {
            in = new BufferedInputStream(System.in, BS);
        }
    }

    private char getChar() {
        while (bId == size) {
            try {
                size = in.read(buf);
            } catch (Exception e) {
                return NC;
            }
            if (size == -1) return NC;
            bId = 0;
        }
        return (char) buf[bId++];
    }

    public int nextInt() {
        return (int) nextLong();
    }

    public int[] nextInts(int N) {
        int[] res = new int[N];
        for (int i = 0; i < N; i++) {
            res[i] = (int) nextLong();
        }
        return res;
    }

    public long[] nextLongs(int N) {
        long[] res = new long[N];
        for (int i = 0; i < N; i++) {
            res[i] = nextLong();
        }
        return res;
    }

    public long nextLong() {
        cnt = 1;
        boolean neg = false;
        if (c == NC) c = getChar();
        for (; (c < '0' || c > '9'); c = getChar()) {
            if (c == '-') neg = true;
        }
        long res = 0;
        for (; c >= '0' && c <= '9'; c = getChar()) {
            res = (res << 3) + (res << 1) + c - '0';
            cnt *= 10;
        }
        return neg ? -res : res;
    }

    public double nextDouble() {
        double cur = nextLong();
        return c != '.' ? cur : cur + nextLong() / cnt;
    }

    public double[] nextDoubles(int N) {
        double[] res = new double[N];
        for (int i = 0; i < N; i++) {
            res[i] = nextDouble();
        }
        return res;
    }

    public String next() {
        StringBuilder res = new StringBuilder();
        while (c <= 32) c = getChar();
        while (c > 32) {
            res.append(c);
            c = getChar();
        }
        return res.toString();
    }

    public String nextLine() {
        StringBuilder res = new StringBuilder();
        while (c <= 32) c = getChar();
        while (c != '\n') {
            res.append(c);
            c = getChar();
        }
        return res.toString();
    }

    public boolean hasNext() {
        if (c > 32) return true;
        while (true) {
            c = getChar();
            if (c == NC) return false;
            else if (c > 32) return true;
        }
    }
}