//const int K = 50;
//bool comp(pll a, pll b){
//    return a.Y*b.X < b.Y*a.X;
//}
//void __(){
//    ll n,t;
//    cin >> n >> t;
//    _(vpll,a,n);
//    vl zero;
//    vpll nonzero;
//    for(auto &_ : a){
//        _.Y += _.X+1;
//        if(_.X == 0)
//            zero.pb(_.Y);
//        else
//            nonzero.pb(_);
//    }
//    sort(all(nonzero),comp);
//    sort(all(zero));
//    zero.insert(zero.begin(),0);
//    rep(i,1,sz(zero)-1)
//        zero[i] += zero[i-1];
//    vl dp(K,MOD);
//    dp[0] = 0;
//    for(auto _ : nonzero){
//        per(i,K-1)
//            if(dp[i] <= t)
//                dp[i+1] = min(dp[i+1],dp[i]+dp[i]*_.X+_.Y);
//    }
//    int ans = 0;
//    rep(i,K)
//        rep(j,sz(zero))
//            if(dp[i]+zero[j] <= t)
//                ans = max(ans,i+j);
//    print ans;
//
//
//}
//
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define pb push_back
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define REP_ZERO_INT(i,r) for(int i = 0; i < r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT,REP_ZERO_INT)(__VA_ARGS__)
#define PER_ZERO_INT(i,r) for(int i = r-1; i >= 0; --i)
#define GET_PER_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define per(...) GET_PER_MACRO(__VA_ARGS__,PER_ANY,PER_INT,PER_ZERO_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define X first
#define Y second
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
template <typename F, typename S> static
istream& operator>>(istream& stream, pair<F, S>& t){
    return stream >> t.first >> t.second;
}
T1 istream& read(T, T, istream& = cin);
T1 istream& operator>>(istream& stream, vector<T>& t){
    return read(all(t), stream);
}
T1 istream& read(T b, T e, istream& stream){
    for(T it = b; it != e; ++it)
        stream >> *it;
    return stream;
}
struct _print {
    string sep,end;
    bool space;
    ostream &stream;
    _print(string _sep=" ",string _end="\n",
            ostream &_stream = cout)
        : sep(_sep),end(_end),space(false),
            stream(_stream) {}
    ~_print() { stream << end; }
    template <typename T>
        _print &operator , (const T &t) {
            if (space) stream << sep;
            space = true;
            stream << t;
            return *this;
        }
};
#define print _print(),
#define _IWI(type,name,...) type name(__VA_ARGS__); cin >> name
#define GET_INPUT_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define _(...) GET_INPUT_MACRO(__VA_ARGS__,_IWI,_IWI,_IWI,_IWI,_IWI,_IWI,INPUT_WITHOUT_INIT)(__VA_ARGS__)
const int K = 50;
bool comp(pll a, pll b){
    return a.Y*b.X < b.Y*a.X;
}
void __(){
    ll n,t;
    cin >> n >> t;
    _(vpll,a,n);
    vl zero;
    vpll nonzero;
    for(auto &_ : a){
        _.Y += _.X+1;
        if(_.X == 0)
            zero.pb(_.Y);
        else
            nonzero.pb(_);
    }
    sort(all(nonzero),comp);
    sort(all(zero));
    zero.insert(zero.begin(),0);
    rep(i,1,sz(zero)-1)
        zero[i] += zero[i-1];
    vl dp(K,MOD);
    dp[0] = 0;
    for(auto _ : nonzero){
        per(i,K-1)
            if(dp[i] <= t)
                dp[i+1] = min(dp[i+1],dp[i]+dp[i]*_.X+_.Y);
    }
    int ans = 0;
    rep(i,K)
        rep(j,sz(zero))
            if(dp[i]+zero[j] <= t)
                ans = max(ans,i+j);
    print ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        __();
}


Measured memory_bytes: 9712