n, k = map(int, input().split())
n_list = list(map(int, input().split()))
p_list = list(input().strip())  # 确保p_list长度正确

# 处理价格(转成分,优惠逻辑修正)
for i in range(n):
    if p_list[i] == '1':
        n_list[i] = n_list[i] * 95  # 优惠后价格(分)
    else:
        n_list[i] = n_list[i] * 100  # 原价(分)
k *= 100  # 余额转成分

n_list.sort()  # 升序排序,优先买便宜的

total = 0
count = 0
for price in n_list:
    if total + price > k:
        break
    total += price
    count += 1

print(count)