Minimum Subarray with k distinct element of another array

Find the minimum length of subarray A[](first array of size N)which contains k distinct element of array B[] ( second array of size M)