#include <bits/stdc++.h>          
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll nC2(ll n) {return n*(n-1)/2;}

int main() {
    ll N, K; cin >> N >> K;

    // cout << "cin is ok" << endl;

    vector<vector<ll>> dp(4,vector<ll>(3*N+1));
    vector<vector<ll>> S(4,vector<ll>(3*N+1));
    dp[0][0] = S[0][0] = 1LL;
    repp(i,1,3*N+1) S[0][i] += S[0][i-1];
    for (ll cnt=1; cnt<=3; cnt++) {
        rep(sum,3*N+1) {
            ll i = sum - 1, j = sum - N - 1;
            if (i<0) continue;
            ll x = S[cnt-1][i], y = 0;
            if (j>=0) y = S[cnt-1][j];
            dp[cnt][sum] = x - y;
            if (sum) S[cnt][sum] = S[cnt][sum-1] + dp[cnt][sum];
        }
    }

    // cout << "dp is ok" << endl;
    // cout << S[3][6] << endl;

    vector<ll> X = S[3];

    ll sum = -1;
    rep(i,3*N+1) if (K<=X[i]) {sum = i; break;}

    K -= X[sum-1];

    ll I = -1, J = -1, cntI = 0;
    for (ll i=max(sum-2*N,1LL); i<=min(sum-2,N); i++) {
        ll tmp = min(sum-i-1,N) - max(sum-i-N,1LL) + 1;
        if (K<=cntI+tmp) {
            I = i;
            K -= cntI;
            J = max(sum-i-N,1LL) + K - 1;
            break;
        }
        cntI += tmp;
    }

    cout << I << " ";
    cout << J << " ";
    cout << sum - I - J << endl;
}
#include <iostream>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,n) for(long long int  i=0;i<n;i++)
#define repl(i,L,R)  for(long long int  i=L;i<=R;i++)
#define vc std::vector<char> 
const long long int MOD=1e9+7;
const char nl='\n';
#define vli std::vector<long long int>
#define sc std::set<char> 
#define sli std::set<long long int > 
#define qc std::queue<char > 
#define qli std::queue<long long int >
#define mli std::map<long long int ,long long int> 
#define mc std::map<char, long long int> 
#define umli std::unordered_map<long long int,long long int>
#define umc std::unordered_map<char,long long int>
#define mem(arr, x) memset(&arr, x, sizeof(arr))
#define debug(x) cerr <<"["<<#x<<" : "<<x<<"]"<<'\n';
#define gap ' '
#define ff first
#define ss second	
#include<cmath>
#include<bits/stdc++.h>	
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

void read(ll arr[],ll n){ for(ll i=0;i<n;i++)  cin>>arr[i];}
void solve()
{
	ll n;
	cin>>n;
	unsigned ll x;
	cin>>x;
	x*=100000000;
	unsigned ll val=0;
	bool consta=true;
	rep(i,n)
	{
		ll v,p1;
		cin>>v>>p1;
		val+=((p1*v)*1000000);
		if(val>x)
		{
			consta=false;
			cout<<i+1<<nl;break;}
	}
	
cerr<<val;
if(consta)
cout<<"-1"<<nl;
}


int main() {
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
         ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     srand(chrono::high_resolution_clock::now().time_since_epoch().count());
ll t=1;
// cin>>t;
while(t--)
{
solve();
}

// cerr<<"Time Elapsed: "<<((double)(clock()-clk))/CLOCKS_PER_SEC<<endl;
	// your code goes here
	return 0;
}