using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            HitachiD();
        }
       
        static void HitachiD()
        {
            var nt = ReadLongN();
            var N = nt[0];
            var T = nt[1];
            var AB = ReadTupleLong((int)N);

            var AB1 = AB.Where(x => x.Item1 > 0).ToArray();
            Array.Sort(AB1, (x, y) => (y.Item1 * (x.Item2 + 1)).CompareTo(x.Item1 * (y.Item2 + 1)));

            int maxj = 40;
            long maxt = T + 1;
            long[] time = Enumerable.Range(0, maxj).Select(i => maxt).ToArray();
            time[0] = 0;
            foreach (var ab in AB1)
            {
                for (int j = maxj - 2; j >= 0; --j)
                {
                    time[j + 1] = Math.Min(time[j + 1], (time[j] + 1) * (ab.Item1 + 1) + ab.Item2);
                }
            }
            var bs = AB.Where(x => x.Item1 == 0).Select(x => x.Item2 + 1).OrderBy(x => x).ToArray();
            int max = 0;
            for(int i = 0; i < maxj; ++i)
            {
                if (time[i] <= T)
                {
                    max = Math.Max(max, i);
                }
                for (int j = 0; j < bs.Length; ++j)
                {
                    var t = time[i] + bs[j];
                    if (t <= T)
                    {
                        time[i] = t;
                        max = Math.Max(max, i + j + 1);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.WriteLine(max);
        }



        static string ReadStr()
        {
            return Console.ReadLine();
        }
        static string[] ReadStrN()
        {
            return Console.ReadLine().Split(' ');
        }
        static int ReadInt()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        static int[] ReadIntN()
        {
            return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
        }
        static long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        static long[] ReadLongN()
        {
            return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
        }
        static Tuple<string, string>[] ReadTupleStr(int n)
        {
            List<Tuple<string, string>> list = new List<Tuple<string, string>>();
            for (int i = 0; i < n; ++i)
            {
                var ab = ReadStrN();
                list.Add(new Tuple<string, string>(ab[0], ab[1]));
            }
            return list.ToArray();
        }
        static Tuple<long, long>[] ReadTupleLong(int n)
        {
            List<Tuple<long, long>> list = new List<Tuple<long, long>>();
            for (int i = 0; i < n; ++i)
            {
                var ab = ReadLongN();
                list.Add(new Tuple<long, long>(ab[0], ab[1]));
            }
            return list.ToArray();
        }
        static Tuple<double, double>[] ReadTupleDouble(int n)
        {
            List<Tuple<double, double>> list = new List<Tuple<double, double>>();
            for (int i = 0; i < n; ++i)
            {
                var ab = ReadLongN();
                list.Add(new Tuple<double, double>(ab[0], ab[1]));
            }
            return list.ToArray();
        }
        static Dictionary<int, HashSet<int>> ReadAdjacencyList(int N, int M)
        {
            Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
            for (int i = 0; i <= N; ++i)
            {
                dict.Add(i, new HashSet<int>());
            }
            for (int i = 0; i < M; ++i)
            {
                var ab = ReadIntN();
                dict[ab[0]].Add(ab[1]);
                dict[ab[1]].Add(ab[0]);
            }
            return dict;
        }
    }
}


Measured memory_bytes: 36216