#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define F first
#define S second
typedef pair<int, int> P;
const int N = 30 + 5, INF = 0x3f3f3f3f;
inline int read() {
	int x = 0, f = 0; char ch = 0;
	while (!isdigit(ch)) f |= ch == '-', ch = getchar();
	while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}
bool cmp(P a, P b) {
	return b.F * (a.S + 1) < a.F *(b.S + 1) ;
}
vector <P> a; vector <int> b;
int f[N];
signed main() {
	int n = read(), T = read();
	for (int i = 1; i <= n; i++) {
		int x = read(), y = read();
		if (x) a.pb(make_pair(x, y));
		else b.pb(y + 1);
	}
	sort(a.begin(), a.end(), cmp);
	sort(b.begin(), b.end());
	for (int i = 1; i < b.size(); i++) b[i] += b[i - 1];
	for (int i = 1; i <= 30; i++) f[i] = T + 1;
	for (int i = 0; i < a.size(); i++)
		for (int j = 30; j; j--)
			f[j] = min(f[j], (f[j - 1] + 1) * (a[i].F + 1) + a[i].S);
	int ans = 0;
	for (int i = 0; i <= 30; i++) 
		if (f[i] <= T) ans = max(ans, i + (b.empty() ? 0 : upper_bound(b.begin(), b.end(), T - f[i]) - b.begin()));
	printf("%lld\n", ans);
	return 0;
}