Please find my mistake

please find my mistake
input
5 3
1 2 8 4 9
output
0 // should be 3