#include #include using namespace std; #define NMAX 50 int main(){ int N; long long K; string S; long long data[NMAX]; long long eatdata[NMAX]; cin>>N>>K; cin>>S; for(int i=0;i=K) break; if(eatdata[nw]!=-1){ break; } eatdata[nw]=c; c++; eatc+=data[nw]; nw+=data[nw]; nw%=N; } //cout<=K) break; c++; eatc+=data[nw]; nw+=data[nw]; nw%=N; } cout<