Help me in solving BILM problem

My issue

why for k = 1 and binary = 101 answer will not be 01 ?

My code

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

class Codechef
{
    public static int solve() {
        return 0;    
    }
    
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s = new Scanner(System.in);
		
		int t = s.nextInt();
		
		while(t-->0) {
		    int n = s.nextInt();
		    int k = s.nextInt();
		    String bin = s.next();
		    
		  //  '0 1 1'
		    String ans = "";
		    boolean diff = false;
		    int left = 0;
		    
		    for(int i=0;i<n;++i) {
		        if(bin.charAt(i) == '1') {
		            if(k == 0) ans += '1';
		            else {
		               if(!diff) ams
		                --k;
		            }
		        }
		        else ans += '0';
		    }
		    
		    if(k != 0) ans = ans.substring(0, ans.length() - k);
            
		  //  if(ans.equals("")) ans = bin;
		    
		    System.out.println(ans);
		}
	}
}

Problem Link: Binary Minimal Practice Coding Problem - CodeChef

@bleedknight4
answer will be 001 because its lexicographically smaller than 01.

@dpcoder_007 thanks