#!/usr/bin/env pypy3



import sys

import math

import itertools

import bisect



INF = int(1e18)

T_MAX = int(1e9)



def main():

    N, T = list(map(int, sys.stdin.readline().split()))

    shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]



    nzshops = [(a, b) for a, b in shops if a > 0]

    zshops  = [(a, b) for a, b in shops if a == 0]



    nzshops.sort(key=lambda x: x[0] / (x[0] + x[1] + 1), reverse=True)

    zshops.sort()



    dp = [[0] + [INF] * int(math.log(T_MAX, 2)) for _ in range(len(nzshops) + 1)]

    for i in range(1, len(dp)):

        for c in range(1, len(dp[i])):

            a, b = nzshops[i - 1]

            t = dp[i - 1][c - 1] + 1

            dp[i][c] = min(dp[i - 1][c], t + t * a + b)



    rs = list(itertools.accumulate(1 + b for _, b in zshops))

    ans = max(c + bisect.bisect(rs, T - dp[-1][c])

            for c in range(len(dp[-1])) if dp[-1][c] <= T)



    print(ans)



if __name__ == '__main__':

    main()
#!/usr/bin/env pypy3



import sys

import math

import itertools

import bisect



INF = int(1e18)



def main():

    n, t = list(map(int, sys.stdin.readline().split()))



    nzshops = []

    zshops = []

    for _ in range(n):

        a, b = list(map(int, sys.stdin.readline().split()))

        (zshops if a == 0 else nzshops).append((a, b))



    nzshops.sort(key=lambda x: x[0] / (x[0] + x[1] + 1), reverse=True)

    zshops.sort()



    dp = [0]

    for i in range(len(nzshops)):

        dp_ = dp + [INF]

        for c in range(1, len(dp_)):

            a, b = nzshops[i]

            x = dp[c - 1] + 1

            dp_[c] = min(dp_[c], x + x * a + b)

        dp = [x for x in dp_ if x <= t]



    rs = list(itertools.accumulate(1 + b for _, b in zshops))

    ans = max(c + bisect.bisect(rs, t - dp[c])

            for c in range(len(dp)) if dp[c] <= t)



    print(ans)



if __name__ == '__main__':

    main()
#!/usr/bin/env pypy3
import sys
import math
import itertools
import bisect

INF = int(1e18)
T_MAX = int(1e9)


def main():
    N, T = list(map(int, sys.stdin.readline().split()))
    shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
    nzshops = [(a, b) for a, b in shops if a > 0]
    zshops = [(a, b) for a, b in shops if a == 0]
    nzshops.sort(key=lambda x: x[0] / (x[0] + x[1] + 1), reverse=True)
    zshops.sort()
    dp = [[0] + [INF] * int(math.log(T_MAX, 2)) for _ in range(len(nzshops) + 1)]
    for i in range(1, len(dp)):
        for c in range(1, len(dp[i])):
            a, b = nzshops[i - 1]
            t = dp[i - 1][c - 1] + 1
            dp[i][c] = min(dp[i - 1][c], t + t * a + b)
    rs = list(itertools.accumulate(1 + b for _, b in zshops))
    ans = max(
        c + bisect.bisect(rs, T - dp[-1][c])
        for c in range(len(dp[-1]))
        if dp[-1][c] <= T
    )
    print(ans)


if __name__ == "__main__":
    main()

#!/usr/bin/env pypy3
import sys
import math
import itertools
import bisect

INF = int(1e18)


def main():
    n, t = list(map(int, sys.stdin.readline().split()))
    nzshops = []
    zshops = []
    for _ in range(n):
        a, b = list(map(int, sys.stdin.readline().split()))
        (zshops if a == 0 else nzshops).append((a, b))
    nzshops.sort(key=lambda x: x[0] / (x[0] + x[1] + 1), reverse=True)
    zshops.sort()
    dp = [0]
    for i in range(len(nzshops)):
        dp_ = dp + [INF]
        for c in range(1, len(dp_)):
            a, b = nzshops[i]
            x = dp[c - 1] + 1
            dp_[c] = min(dp_[c], x + x * a + b)
        dp = [x for x in dp_ if x <= t]
    rs = list(itertools.accumulate(1 + b for _, b in zshops))
    ans = max(c + bisect.bisect(rs, t - dp[c]) for c in range(len(dp)) if dp[c] <= t)
    print(ans)


if __name__ == "__main__":
    main()

-T_MAX = int(1e9) -    N, T = list(map(int, sys.stdin.readline().split())) -    shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] -    nzshops = [(a, b) for a, b in shops if a > 0] -    zshops = [(a, b) for a, b in shops if a == 0] +    n, t = list(map(int, sys.stdin.readline().split())) +    nzshops = [] +    zshops = [] +    for _ in range(n): +        a, b = list(map(int, sys.stdin.readline().split())) +        (zshops if a == 0 else nzshops).append((a, b)) -    dp = [[0] + [INF] * int(math.log(T_MAX, 2)) for _ in range(len(nzshops) + 1)] -    for i in range(1, len(dp)): -        for c in range(1, len(dp[i])): -            a, b = nzshops[i - 1] -            t = dp[i - 1][c - 1] + 1 -            dp[i][c] = min(dp[i - 1][c], t + t * a + b) +    dp = [0] +    for i in range(len(nzshops)): +        dp_ = dp + [INF] +        for c in range(1, len(dp_)): +            a, b = nzshops[i] +            x = dp[c - 1] + 1 +            dp_[c] = min(dp_[c], x + x * a + b) +        dp = [x for x in dp_ if x <= t] -    ans = max( -        c + bisect.bisect(rs, T - dp[-1][c]) -        for c in range(len(dp[-1])) -        if dp[-1][c] <= T -    ) +    ans = max(c + bisect.bisect(rs, t - dp[c]) for c in range(len(dp)) if dp[c] <= t)