import java.math.BigDecimal; import java.util.Arrays; import java.util.Scanner; public class Main { public static long simulate(final int N, int[] S, long K, final long initial_bonus){ long bonus = initial_bonus; long cost = 0; for(long i = 0; i < K; i++){ final int index = (int)(i % N); if(bonus > 0){ bonus--; }else{ cost++; } bonus += S[index]; } return cost; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final long K = sc.nextLong(); char[] inputs = sc.next().toCharArray(); int[] S = new int[N]; for(int i = 0; i < N; i++){ S[i] = Character.getNumericValue(inputs[i]); } int one_cycle_cost = 0, one_cycle_bonus = 0; for(int i = 0; i < N; i++){ if(one_cycle_bonus > 0){ one_cycle_bonus--; }else{ one_cycle_cost++; } one_cycle_bonus += S[i]; } if(one_cycle_bonus > 0){ if(one_cycle_bonus >= one_cycle_cost){ System.out.println(one_cycle_cost); }else{ System.out.println(one_cycle_cost + Math.max(0, one_cycle_cost - one_cycle_bonus) * Math.max(0, K / N - 1) + simulate(N, S, K % N, one_cycle_bonus)); } }else{ System.out.println((K / N * one_cycle_cost) + simulate(N, S, K % N, 0)); } } }