K Divisible Elements Subarrays
Given an integer array `nums`, an allowance `k`, and a divisor `p`, count the distinct contiguous value sequences that contain at most `k` elements divisible by `p`. Occurrences at different positions count once when their values are identical in the same order.