using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
public static void Main() {string[] inputs = Console.ReadLine().Split(' ');
int n = int.Parse(inputs[0]);
long k = long.Parse(inputs[1]);
long[] prices = Console.ReadLine()
.Split(' ')
.Select(long.Parse)
.ToArray();
char[] alipayFlags = Console.ReadLine().ToCharArray();
// 统一放大100倍
for (int i = 0; i < n; i++)
{
if (alipayFlags[i] == '1')
prices[i] *= 95; // 支持优惠:*95
else
prices[i] *= 100; // 不支持:*100
}
// 排序
Array.Sort(prices);
// 放大余额
k *= 100;
// 贪心算法
int count = 0;
for (int i = 0; i < n; i++)
{
if (k >= prices[i])
{
k -= prices[i];
count++;
}
else
break;
}
Console.WriteLine(count);
}
}