using System; public class Hello { public static int buy, atari, eat; static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var k = int.Parse(line[1]); var s = Console.ReadLine().Trim(); getAns(n, k, s); } static void getAns(int n, int k, string s) { var m = k / n; var mod = k % n; if (m== 0) { Console.WriteLine(sim0(n,k,s)); return; } if (mod == 0) m--; var a = 0; foreach (var x in s) a += x - '0'; if (a > n) { Console.WriteLine(1); return; } var b = n - a; var nk = k - n * (m - 1); var ans2 = sim0(2 * n, nk, s + s); var ans = ans2 + b * (m - 1); Console.WriteLine(ans); } static int sim0(int n, int k, string s) { if (k == 1) return 1; buy = 1; atari += s[0] - '0'; eat = 1; var p = 1; while (p < n) { if (atari > 0) atari--; else buy++; atari += s[p] - '0'; eat++; if (eat == k) return buy; p++; } return -1; } }