Given an array A of N (N<=2*10^4) elements and Q(Q<=10^6) queries. Each array element A[i]<=60.
In each query you are given a number K (K<=N). Compute LCM for all subarrays of size K and report the smallest value of LCM found.
Please suggest some approach for this problem.