#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define BET(a,b,c) ((a)<=(b)&&(b)<(c)) #define FOR(i,n) for(int i=0,i##_end=(int(n));i VI; typedef vector VVI; int main() { int N,K; string S; cin>>N>>K>>S; VI hist(N, -1); int ans = 0 ; int atari = 0 ; FOR(i,K){ if(atari == 0){ ans++; atari++; } atari--; atari += S[i%N] - '0'; if(i > N && ans == 1) break; if(i > N){ if(hist[i%N] == -1){ hist[i%N] = ans; }else{ int loopIncreasing = ans - hist[i%N]; int rem = K - (i + 1); int loop = rem / N; ans += loop * loopIncreasing; i += loop * N; //cout<