module mod_two_dim_merge_sort
  implicit none
  integer, private, parameter :: intkind = 8
contains
  logical function less(a, b) result(res)
    integer(intkind), intent(in) :: a(:), b(:)
    real(8) :: a1, b1
    a1 = a(1) / real(a(2) + 1, 8)
    b1 = b(1) / real(b(2) + 1, 8)
    res = a1 > b1 .or. (a1 == b1 .and. a(2) >= b(2))
  end
  subroutine merge_sort(a)
    integer(intkind), intent(inout) :: a(:, :)
    integer :: n, m, l, i, u
    n = size(a, 1)
    m = n
    l = 1
    do while (m > 1)
      do i = 1, m / 2
        u = min(2 * i * l, n)
        call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &
        a((2 * i - 1) * l + 1:u, :))
      end do
      l = 2 * l
      m = (m + 1) / 2
    end do
  end
  subroutine merger(a1, a2)
    integer(intkind), intent(inout) :: a1(:, :), a2(:, :)
    integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))
    integer :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(a1, 1)
    n2 = size(a2, 1)
    do while (i1 <= n1 .and. i2 <= n2)
      if (less(a1(i1, :), a2(i2, :))) then
        a(i1 + i2 - 1, :) = a1(i1, :)
        i1 = i1 + 1
      else
        a(i1 + i2 - 1, :) = a2(i2, :)
        i2 = i2 + 1
       end if
    end do
    if (i1 <= n1) then
      a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)
    else
      a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)
    end if
    a1 = a(1:n1, :)
    a2 = a(n1 + 1:n1 + n2, :)
  end
end module mod_two_dim_merge_sort
program manga_market
  use mod_two_dim_merge_sort
  implicit none
  integer(8), parameter :: inf = 3e18
  integer :: n, l, i, j, m = 0, p, q, h
  integer(8) :: t, r, tmp
  integer(8), allocatable :: c(:, :), dp(:, :), s(:)
  read(*,*) n, t
  allocate(c(n, 2))
  do i = 1, n
    read(*,*) c(i, :)
  end do
  call merge_sort(c(1:n, 1:2))
  l = n + 1
  do while (c(l - 1, 1) == 0)
    l = l - 1
  end do
  allocate(dp(0:28, 0:l - 1), s(0:n - 1 + 1))
  dp = inf
  dp(0, :) = 0
  do i = 1, l - 1
    do j = 1, min(28, i)
      dp(j, i) = dp(j, i - 1)
      if (dp(j - 1, i - 1) == inf) cycle
      tmp = dp(j - 1, i - 1) + 1
      dp(j, i) = min(dp(j, i), tmp + c(i, 1) * tmp + c(i, 2))
    end do
  end do
  s(0) = 0
  do i = n, l, -1
    s(n - i + 1) = s(n - i) + c(i, 2) + 1
  end do
  do i = 0, min(28, l - 1)
    r = t - dp(i, l - 1)
    if (r < 0) cycle
    p = 0
    q = n - l + 2
    do while (q - p > 1)
      h = (p + q) / 2
      if (s(h) > r) then
        q = h
      else
        p = h
      end if
    end do
    m = max(m, i + p)
  end do
  write(*,'(i0)') m
end program manga_market