import java.util.Scanner; public class Main_yukicoder78 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); char[] s = sc.next().toCharArray(); int[] a = new int[n + 1]; int[] min = new int[n + 1]; for (int i = 1; i <= n; i++) { if (a[i - 1] > 0) { min[i] = min[i - 1]; a[i] = a[i - 1] - 1 + s[i - 1] - '0'; } else { min[i] = min[i - 1] + 1; a[i] = a[i - 1] + s[i - 1] - '0'; } } if (k > n && a[n] >= min[n]) { System.out.println(min[n]); } else if (k <= n) { System.out.println(min[k]); } else { long ret = (min[n] - a[n]) * (k / n - 1); ret += min[n] + Math.max(0, min[k % n] - a[n]); System.out.println(ret); } sc.close(); } }