Help me in solving BILM problem

My issue

what is the problelm inmy cod e

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
// 	// binatry minimal
// 	// using the atmost k Character
	 Scanner sc=new Scanner(System.in);
	 int t=sc.nextInt();
	 while(t-->0){
	     int n=sc.nextInt();
	     int k=sc.nextInt();
	     String s=sc.next();
	     int i=0;
	    String ans="";
	     while(i<n){
	         char c=s.charAt(i);
	        if(c=='1'){
	            if(k>0){
	                ans=ans+'0';
	                k--;
	            }else{
	            
	              ans=ans+'1';
	        }
	        }else{
	            ans=ans+c;
	            
	        }
	        i++;
	 }
	System.out.println(ans.substring(k,n));

	}
}

}

        

Problem Link: Binary Minimal Practice Coding Problem