Write a function that counts the minimum number of occurrences in an array. The first argument is the provided array, the second argument is how many times to count the occurrence.
let arr = [1,3,4,1,9,1,3,4,3,1,2]
elements(arr, 2) // Should return: [1,3,4]
elements(arr, 3) // Should return: [1,3]