#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, T;
	cin >> N >> T;
	vector<pair<long long, long long> > VA;
	vector<long long> VB;
	for (int i = 0; i < N; i++) {
		long long A, B;
		cin >> A >> B;
		if (A == 0) {
			VB.push_back(B);
		}
		else {
			VA.push_back({ A, B });
		}
	}
	sort(VA.begin(), VA.end(), [](pair<long long, long long> P1, pair<long long, long long> P2) {return P1.first * (P2.second + 1) > P2.first * (P1.second + 1); });
	sort(VB.begin(), VB.end());
	long long INF = T + 1;
	vector<vector<long long> > DP(VA.size() + 1, vector<long long>(30, INF));
	DP[0][0] = 0;
	for (int i = 0; i < VA.size(); i++) {
		for (int j = 0; j < 29; j++) {
			if (DP[i][j] < INF) {
				long long NT = DP[i][j];
				long long Next = (NT + 1) * (VA[i].first + 1) + VA[i].second;
				if (Next <= T) {
					DP[i + 1][j + 1] = min(DP[i + 1][j + 1], Next);
				}
				DP[i + 1][j] = min(DP[i + 1][j], NT);
			}
		}
	}
	vector<long long> COUNT(VB.size() + 1, 0);
	for (int i = 0; i < VB.size(); i++) {
		COUNT[i + 1] = COUNT[i] + VB[i] + 1;
	}
	int ANS = 0;
	for (int i = 0; i < 30; i++) {
		if (DP[VA.size()][i] > T) break;
		for (int j = 0; j <= VB.size(); j++) {
			if (DP[VA.size()][i] + COUNT[j] <= T) {
				ANS = max(ANS, i + j);
			}
		}
	}
	cout << ANS << endl;
}