#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1999999999;

long long int N,a[200050],b[200050],T,dp[50][200050]={},res=0;
vector<pll>notzero;
vector<long long int>zero;

bool cmp (pll one,pll two){
    if((one.second)*(two.first)<(two.second)*(one.first)){return true;}
    else{return false;}
}
int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>T;
    T++;
    for(long long int i = 0; i < N; i++){
        cin>>a[i]>>b[i];
        b[i]++;
        if(a[i]==0){
            zero.push_back(b[i]);
        }else{
            notzero.push_back({a[i],b[i]});
        }
    }

    sort(zero.begin(),zero.end());
    sort(notzero.begin(),notzero.end(),cmp);
    if(notzero.empty()){
        long long int tmp=T-1,restmp=0;
        for(int j=0;j<zero.size();j++){
            if(tmp>=zero[j]){restmp++;}
            else{break;}
            tmp-=zero[j];
        }  
        res  = max(res,restmp);
        cout<<res<<endl;
        return 0;
    }

    long long int nowmin[50]={};
    for(long long int i = 0; i < 45; i++){
        nowmin[i]=INF;
    }
    nowmin[0]=1;
    for(long long int i = 0; i < notzero.size()+5; i++){
        for(long long int j = 0; j < 45; j++){
            dp[j][i]=INF;
        }
    }
    for(long long int i = 0; i < notzero.size(); i++){
        for(long long int j = 40; j >=1; j--){
            
            dp[j][i+1]=min((notzero[i].first+1)*nowmin[j-1]+notzero[i].second,dp[j][i]);
            nowmin[j]=min(nowmin[j],dp[j][i+1]);
        }
    }
    dp[0][notzero.size()]=1;
    for(long long int i = 0; i < 40; i++){
        if(dp[i][notzero.size()]>T){continue;}

        long long int tmp=T-dp[i][notzero.size()],restmp=i;
        for(int j=0;j<zero.size();j++){
            if(tmp>=zero[j]){restmp++;}
            else{break;}
            tmp-=zero[j];
        }  
        res  = max(res,restmp);
    }
    for(long long int i = 0; i < 45; i++){
        //cout<<"DEBUG : i = "<<i<<" -> "<<nowmin[i]<<endl;
    }
    cout<<min(res,N)<<endl;
}



Measured memory_bytes: 78956