#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define mp make_pair
int n,m,f[32],res;
vector<int>zero;
vector<pii>nz;
bool cmp(const pii &x,const pii &y){
	return y.first*x.second<x.first*y.second;
}
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i=1,x,y;i<=n;i++){
		scanf("%lld%lld",&x,&y);
		y+=x+1;
		if(!x)zero.push_back(y);
		else nz.push_back(make_pair(x,y));
	}
	sort(nz.begin(),nz.end(),cmp);
	sort(zero.begin(),zero.end());
	memset(f,0x3f3f3f3f,sizeof(f)),f[0]=0;
	for(auto p:nz)for(int i=30;i>=0;i--)if(f[i]<=m)f[i+1]=min(f[i+1],f[i]*(p.first+1)+p.second);
	for(int i=0,r;i<32;i++){
		if(f[i]>m)continue;
		int k=i;
		for(auto j:zero)if(f[i]+j<=m)f[i]+=j,k++;else break;
		res=max(res,k);
	}
	printf("%lld\n",res);
	return 0;
}