Access Control Practice Coding Problem - CodeChef

import java.util.*;

class Codechef {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int a = sc.nextInt();
            sc.nextLine();
            String x = sc.next();
            int count = 0;
            
            // Check if the first character is '0'
            if (x.charAt(0) == '0') {
                System.out.println("NO");
                continue; // Move to the next test case
            }

            for (int i = 0; i < n - 1; i++) {
                if (x.charAt(i) == '0') {
                    count++;
                    if (x.charAt(i + 1) == '1') {
                        count = 0;
                    } else {
                        continue;
                    }
                } else {
                    continue;
                }
            }

            if (count <= a) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}

my hidden test case is not passing(2nd one) please guide me to understand where am I going wrong

@devangiarora
plzz refer my c++ code for better understanding .
Ping me in case u get stuck at any point.

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int x,n;
	    cin>>n>>x;
	    string s;
	    cin>>s;
	    int val=0;
	    int fnd=0;
	    for(int i=0;i<s.size();i++)
	    {
	        if(s[i]=='0')
	        {
	            if(val>0)
	            val--;
	            else
	            {
	                fnd=1;
	            }
	        }
	        else
	        val=x;
	    }
	    if(fnd)
	    cout<<"NO";
	    else
	    cout<<"YES";
	    cout<<endl;
	}

}