Painter probelm

Can we have number of painters i.e K greater than N i.e number of boards. If “no” then what is the problem in my code I think everything is working fine please check https://ide.codingblocks.com/s/165407

@yath17
Input :
3 5 1
1 2 3 4 5

Expected Output :
5

Your Output :
7

Also , yes we can have more painters than the no of boards however that is not the problem with your code as you can clearly see for the above testcase.