#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define endl '\n'

using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

double PI = acos((double)-1);
const ld eps = 1e-7;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
//const ll mod = 1e9 + 9;
const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

const int N = 2e5 + 6;
const int L = 33;

ll dp[N][L];

int smart(int n, int T, vector<pair<int, int>> t) {
	vector<pair<int, int>> a;
	vector<int> b;
	for (int i = 0; i < n; i++) {
		if (t[i].first) a.push_back(t[i]);
		else b.push_back(t[i].second);
	}
	sort(all(a), [](pair<int, int> x, pair<int, int> y) {
		return (x.second + 1) * y.first < (y.second + 1) * x.first;
	});
	//for (auto u : a) cout << u.first << " " << u.second << endl;
	sort(all(b));
	n = a.size();
	int m = b.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < L; j++) {
			dp[i][j] = inf;
		}
	}
	dp[0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < L; j++) {
			if (dp[i][j] > T) continue;
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			if (j != (L - 1))
				dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + 1 + a[i].first * (dp[i][j] + 1) + a[i].second);
			//cout << i << " " << j << " " << dp[i][j] << endl;
		}
	}
	int ans = 0;
	for (int i = 0; i < L; i++) {
		int cur = dp[n][i];
		if (cur > T) continue;
		ans = max(ans, i);
		int t = 0;
		for (int j : b) {
			if (cur + 1 + j > T) break;
			t++;
			cur = cur + 1 + j;
		}
		ans = max(ans, i + t);
	}
	return ans;
}

int kek[1 << 21];
int p[1 << 21];

int stupid(int n, int T, vector<pair<int, int>> t) {
	int ans = 0;
	kek[0] = 0;
	for (int mask = 1; mask < (1 << n); mask++) {
		kek[mask] = inf;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if ((1 << i) & mask) {
				cnt++;
				if (kek[mask ^ (1 << i)] > T) continue;
				int f = kek[mask];
				kek[mask] = min(kek[mask], kek[mask ^ (1 << i)] + 1 + t[i].first * (kek[mask ^ (1 << i)] + 1) + t[i].second);
				if (kek[mask] != f) p[mask] = i;
			}
		}
		//if (mask == 127) cout << p[mask ^ (1 << 2) ^ (1 << 4) ^ (1 << 6) ^ (1 << 1) ^ (1 << 3) ^ (1 << 0)] << " kek\n";
		//cout << mask << " " << kek[mask] << endl;
		if (kek[mask] <= T) {
			ans = max(ans, cnt);
		}
	}
	return ans;
}

void stress() {
	int cnt = 0;
	while (true) {
		cnt++;
		int n = rand() % 20 + 1;
		int T = rand() % 1000;
		vector<pair<int, int>> t(n);
		for (int i = 0; i < n; i++)
			t[i] = { rand() % 10, rand() % 10 };
		int m1 = smart(n, T, t);
		int m2 = stupid(n, T, t);
		if (m1 == m2) {
			cout << "TEST# " << cnt << " OK\n";
		}
		else {
			cout << "TEST# " << cnt << " FAILED\n";
			cout << n << " " << T << endl;
			for (auto u : t)
				cout << u.first << " " << u.second << endl;
			cout << m1 << " ans " << m2 << endl;
			return;
		}
	}
}

void solve() {
	//stress(); return;
	int n, T; cin >> n >> T;
	vector<pair<int, int>> t(n);
	for (auto& u : t) cin >> u.first >> u.second;
	//cout << stupid(n, T, t) << endl;
	cout << smart(n, T, t) << endl;
	return;
}

Measured memory_bytes: 62316