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

typedef long long ll;
const int maxn = 200010;
int n, T, tot1, tot2, ans;
ll f[maxn], c[maxn];
pair<ll, ll> p[maxn];

int main() {
    scanf("%d %d", &n, &T);
    for (int i = 1; i <= n; i++) {
        pair<int, int> tmp;
        scanf("%d %d", &tmp.first, &tmp.second);
        if (!tmp.first) c[++tot2] = tmp.second + 1;
        else p[++tot1] = tmp;
    }
    sort(p + 1, p + tot1 + 1, [&](pair<ll, ll> x, pair<ll, ll> y) {
        return x.first * (y.second + 1) > y.first * (x.second + 1);
    });
    sort(c + 1, c + tot2 + 1);
    for (int i = 1; i <= tot2; i++) {
        c[i] += c[i - 1];
    }
    fill(f + 1, f + 31, T + 1);
    for (int i = 1; i <= tot1; i++) {
        for (int j = 30; j; j--) {
            f[j] = min(f[j], (f[j - 1] + 1) * (p[i].first + 1) + p[i].second);
        }
    }
    for (int i = 0; i <= 30; i++) if (f[i] <= T) {
        int add = !tot2 ? 1 : upper_bound(c + 1, c + tot2 + 1, T - f[i]) - c;
        ans = max(ans, i + add - 1);
    }
    printf("%d\n", ans);
    return 0;
}