//注意精度
#include <bits/stdc++.h>
#include <random>
using namespace std;
const int N=1e5+9;
using ll=long long;
struct Good{
    double price1;  
    double price2;
};
bool cmp(Good g1,Good g2)
{
    return g1.price2<g2.price2;
}
int main() {
    ll n;cin>>n;
    long double k;cin>>k;
    struct Good g[N];
    for(int i=0;i<n;i++) cin>>g[i].price1;
    string s;cin>>s;
   for(int i=0;i<n;i++)
   {
    if(s[i]=='1') g[i].price2=g[i].price1*0.95;
    else g[i].price2=g[i].price1;
   }
    sort(g,g+n,cmp);
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(k>=g[i].price2)
        {
            cnt++;
            k-=g[i].price2;
        }
    }
    cout<<cnt;
}
// 64 位输出请用 printf("%lld")