Longest subarray with sum K

for below test case output should be 8 but the code implementation in video is giving output 6

length of array=10
K= 3
given array=1 2 3 -3 -2 -1 4 1 0 1

Hey,you might be missing something while writing the code.I implemented the exact same code and it is giving 8 as output.