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=0; int atari=0; int i=0; while(had0){ paid--; atari--; } if(s.charAt(i%n)=='0'){ had++; }else if(s.charAt(i%n)=='1'){ had++; atari++; }else if(s.charAt(i%n)=='2'){ had++; atari+=2; } if(i==n-1){ if(paid<=atari){ break; } } i++; } System.out.println(paid); } }