import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int n = koko.nextInt(); long k = koko.nextInt(); String s = koko.next(); int had=0; int[] paid = new int[n]; int atari=0; paid[0]=1; if(s.charAt(0)=='1'){ atari=1; }else if(s.charAt(0)=='2'){ atari=2; } for(int i=1; i0){ paid[i]--; atari--; } if(s.charAt(i)=='1'){ atari++; }else if(s.charAt(i)=='2'){ atari+=2; } } if(n>=k){ System.out.println(paid[(int)k-1]); }else{ if(atari>=paid[n-1]){ System.out.println(paid[n-1]); }else if(atari==0){ int amari = (int)k%n; int ama=0; if(amari!=0){ ama=paid[amari-1]; } long rpay = (paid[n-1]*(k-amari)/n)+ama; System.out.println(rpay); }else{ int amari=(int)k%n; int ama=0; if(amari!=0&&atari<=paid[amari-1]){ ama=paid[amari-1]-atari; } long rpay = ama+atari+((paid[n-1]-atari)*(k-amari)/n); System.out.println(rpay); } } } }