Test Case giving correct result as expected, still failing with Array index out of Bound


#1

This test case this failing for me with error Array index out of Bound :
A : [ 251, 286, 420, 491, 506, 34, 716, 829, 615, 53, 807, 837, 750, 650, 181, 140, 543, 944, 210, 113, 551, 379, 818, 817, 227, 525, 257, 735, 932, 172, 410, 935, 351, 347, 521, 168, 482, 885, 612, 352 ]
B : 9
Although, it is giving correct answer as expected when i ran it as custom input and compared the output. Unnecessarily score seems to be decreasing and i don’t know what is wrong.