Problem: Check if Array has at least M non-overlapping Subarray with gcd G
Given an array A[] and M, the task is to check whether there exist M non-overlapping subarrays(non-empty) of A for which the average of the GCD of those subarrays equals G where G denotes the gcd of all the numbers in the array A.

Sample Input: A[] = {1, 2, 3, 4, 5}, M = 3
Sample Output: Yes
?Explanation: Here, G = gcd(1, 2, 3, 4, 5) = 1.
We can choose 3 non overlapping subarrays {[1], [2, 3], [4, 5]} where
gcd(1) = 1, gcd(2, 3) = 1, and gcd(4, 5) = 1.
Thus, the average = (1 + 1 + 1)/3 = 1. Hence, we can have 3 such subarrays.

Solution (python):
# Python code to implement the approach

# Function to find gcd of two numbers
def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b, a % b)

# Function to find check whether
# non-overlapping subarray exists
def find(arr, n, m):
    G = 0
    g = 0
    count = 0
    for i in range(n):
        G = gcd(G, arr[i])

    for i in range(n):
        g = gcd(g, arr[i])
        if (g == G):
            count += 1
            g = 0

    if (count >= m):
        return "Yes"
    return "No"

# Driver code
if __name__ == "__main__":
    A = [1, 2, 3, 4, 5]
    N = 5
    K = 3
    
    # Function call
    print(find(A, N, K))