Given an integer array `arr` and an integer `k`, count the total number of contiguous subarrays that contain **at most `k` distinct** elements.
arr = array of integers, k = limit of distinct values
integer (number of subarrays with <= k distinct elements)
Example 1:
Input:
arr = [1,2,2,3] k = 2
Output:
9
Example 2:
Input:
arr = [1,2,1,3] k = 2
Output:
8