Failing to pass 2 test cases for "chef and special dishes" from march long challenge.

I tried to solve thisproblem for march long challenge but my solution is failing to pass two test cases. Can anyone tell me what is bug in my code.

Here: https://www.codechef.com/viewsolution/9716915

added

        if(l<=1)
            System.out.println("NO");

@nilesh3105

Thank you.