WA in Chef and Interesting Subsequences problem (CHEFINSQ)

I am writing a code for: " Chef and Interesting Subsequences"

I completed this code and test with diff -diff test cases but at the time of submit still its showing me wrong answer. I am not able to understand what’s wrong with my code.

https://www.codechef.com/viewsolution/29354282

Thanks in Advance…

Consider the testcase:

2                                                   
4 2
1 2 3 4
4 2
1 2 3 4
1 Like