A CPU must run n tasks, each labeled by an uppercase letter. Each task takes exactly one time interval. Two runs of the same label must be separated by at least k intervals in between (during which the CPU runs other tasks or sits idle). The CPU runs at most one task per interval and may idle.
Return the minimum number of intervals needed to finish every task.
Input format
Line 1: two integers n and k — the number of tasks and the required cooldown gap between identical tasks.
Line 2: n space-separated uppercase letters (A-Z), the task labels (present whenever n >= 1).
Output format
A single integer: the minimum number of intervals (counting idle intervals) to complete all tasks.
Constraints
- 1 <= n <= 100000
- 0 <= k <= 100
- Each label is an uppercase letter A-Z.