Why `k+1` tasks in this solution in the problem?

Could you please explain why K+1 tasks?

We need to make sure that the same tasks are k distance apart. For example:
[a, b, a], k=3

When we execute task “a” we can run k=3 more tasks before running “a” again. Hence, we can execute as many as k+1=4 tasks in one iteration. (the first task + 3 more tasks)

If for any iteration, we are not able to execute k+1 tasks, the CPU has to remain idle for the remaining time in the next iteration.