import bisect



N, T = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(N)]



"""

a_x = 1 and b_x is t_i = 2*(t_i +2) 

n 店舗回るのに 2^nはかかる

30店舗以上は回れない

"""



a0 = []

nab = []

for a, b in AB:

    if a == 0:

        a0.append(b)

    else:

        nab.append(((b + 1) / a, a, b))

a0.sort()



nab.sort()



a0sum = []  # key: n of visit, value : cost

_sum = 0

for b in a0:

    _sum += 1 + b

    a0sum.append(_sum)



INF = 1 << 32

dp = [0] + [INF] * 29

for index, (_, a, b) in enumerate(nab):

    # print(a, b)

    ndp = [0] + [INF] * 29

    for count in range(1, 29):

        ndp[count] = min(dp[count],

                         dp[count - 1] + 1 + (dp[count - 1] + 1) * a + b)

    dp = ndp



ans = 0

# print(a0sum)

# print(nab)

# print(dp)

for count, t in enumerate(dp):

    if t > T:

        continue

    v = bisect.bisect_right(a0sum, T - t)

    ans = max(ans, v + count)

print(ans)

import bisect

import sys

input = sys.stdin.readline

N, T = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(N)]



"""

a_x = 1 and b_x is t_i = 2*(t_i +2) 

n 店舗回るのに 2^nはかかる

30店舗以上は回れない

"""



a0 = []

nab = []

for a, b in AB:

    if a == 0:

        a0.append(b)

    else:

        nab.append(((b + 1) / a, a, b))

a0.sort()



nab.sort()



a0sum = []  # key: n of visit, value : cost

_sum = 0

for b in a0:

    _sum += 1 + b

    a0sum.append(_sum)



INF = 1 << 32

dp = [0] + [INF] * 29

for index, (_, a, b) in enumerate(nab):

    # print(a, b)

    ndp = [0] + [INF] * 29

    for count in range(1, 29):

        ndp[count] = min(dp[count],

                         dp[count - 1] + 1 + (dp[count - 1] + 1) * a + b)

    dp = ndp



ans = 0

# print(a0sum)

# print(nab)

# print(dp)

for count, t in enumerate(dp):

    if t > T:

        continue

    v = bisect.bisect_right(a0sum, T - t)

    ans = max(ans, v + count)

print(ans)

import bisect

N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
"""
a_x = 1 and b_x is t_i = 2*(t_i +2) 
n 店舗回るのに 2^nはかかる
30店舗以上は回れない
"""
a0 = []
nab = []
for a, b in AB:
    if a == 0:
        a0.append(b)
    else:
        nab.append(((b + 1) / a, a, b))
a0.sort()
nab.sort()
a0sum = []  # key: n of visit, value : cost
_sum = 0
for b in a0:
    _sum += 1 + b
    a0sum.append(_sum)
INF = 1 << 32
dp = [0] + [INF] * 29
for index, (_, a, b) in enumerate(nab):
    # print(a, b)
    ndp = [0] + [INF] * 29
    for count in range(1, 29):
        ndp[count] = min(dp[count], dp[count - 1] + 1 + (dp[count - 1] + 1) * a + b)
    dp = ndp
ans = 0
# print(a0sum)
# print(nab)
# print(dp)
for count, t in enumerate(dp):
    if t > T:
        continue
    v = bisect.bisect_right(a0sum, T - t)
    ans = max(ans, v + count)
print(ans)

import bisect
import sys

input = sys.stdin.readline
N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
"""
a_x = 1 and b_x is t_i = 2*(t_i +2) 
n 店舗回るのに 2^nはかかる
30店舗以上は回れない
"""
a0 = []
nab = []
for a, b in AB:
    if a == 0:
        a0.append(b)
    else:
        nab.append(((b + 1) / a, a, b))
a0.sort()
nab.sort()
a0sum = []  # key: n of visit, value : cost
_sum = 0
for b in a0:
    _sum += 1 + b
    a0sum.append(_sum)
INF = 1 << 32
dp = [0] + [INF] * 29
for index, (_, a, b) in enumerate(nab):
    # print(a, b)
    ndp = [0] + [INF] * 29
    for count in range(1, 29):
        ndp[count] = min(dp[count], dp[count - 1] + 1 + (dp[count - 1] + 1) * a + b)
    dp = ndp
ans = 0
# print(a0sum)
# print(nab)
# print(dp)
for count, t in enumerate(dp):
    if t > T:
        continue
    v = bisect.bisect_right(a0sum, T - t)
    ans = max(ans, v + count)
print(ans)

+import sys +input = sys.stdin.readline