import java.util.*;
import java.io.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(bf.readLine());
        int n = Integer.valueOf(st.nextToken());
        int k = Integer.valueOf(st.nextToken());
        List<Double> priceList = new ArrayList<>(n);
        st = new StringTokenizer(bf.readLine());
        for(int i=0;i<n;i++){
            priceList.add(Double.parseDouble(st.nextToken()));
        }
        String isDiscount= bf.readLine();
        for(int i=0;i<n;i++){
            if(isDiscount.charAt(i) == '1'){
                priceList.set(i, priceList.get(i) * 0.95);
            }
        }
        Collections.sort(priceList);
        double max=0;
        int num=0;
        for(int i=0;i<n;i++){
            max+=priceList.get(i);
            if(max<=k){
                num++;
            }
        }
        System.out.println(num);
    }
}