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){ final int infinit_turns = (one_cycle_cost + one_cycle_bonus - 1) / one_cycle_bonus; final long infinite_N = infinit_turns * N; if(infinite_N <= N){ System.out.println(infinit_turns * one_cycle_cost); }else{ System.out.println(simulate(N, S, K, 0)); } }else{ System.out.println((K / N * one_cycle_cost) + simulate(N, S, K % N, 0)); } } }