Minimum Operations to Collect Elements
Remove elements from the end of the array and track which values 1 to k are still missing until the set is empty.
Remove elements from the end of the array and track which values 1 to k are still missing until the set is empty.