# include<bits/stdc++.h>

using namespace std;
# define l long long 
# define db long double 
# define rep(i,a,b) for(l i=a;i<b;i++)
# define vi vector<l>
# define vvi vector<vi>
# define vsi vector<set<l> >
# define pb push_back
# define mp make_pair
# define ss second
# define ff first
# define pii pair<l,l>
# define trvi(v,it) for(vi::iterator it=v.begin();it!=v.end();++it)
# define read(a) freopen(a,"r",stdin)
# define write(a) freopen(a,"w",stdout)
# define io ios::sync_with_stdio(false)

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ' ' << p.second << ')'; }

const bool MULTIPLE_TEST_CASES = false;

const l MOD=1e9+7;
const l N=1e5+5;
const l INF=1e12;

void solve() {
	l n;
	l x;
	cin>>n>>x;
	vector<l> v(n), p(n);
	rep(i,0,n) {
		cin>>v[i]>>p[i];
	}
	x*=100;
	l cur = 0;
	rep(i,0,n) {
		cur+= (v[i]*p[i]);
		if(cur>x) {
			cout<<i+1<<"\n";
			return;
		}
	}
	cout<<"-1\n";
	return;
}


int main(){
	io;
	int t=1;
	if (MULTIPLE_TEST_CASES) cin>>t;
	rep(i,0,t) {
		solve();
	}

	return 0;
}

#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n;
char p[201000], st[201000];
int main(){
    int i;
    scanf("%d",&n);
    scanf("%s",p);
    int top = 0;
    int res = 0;
    for(i=0;i<n;i++){
        if(p[i]!='f' && p[i]!='o' && p[i]!='x'){
            res += top;
            res++;
            top=0;
            continue;
        }
        st[++top] = p[i];
        while(st[top]=='x' && st[top-1]=='o' && st[top-2]=='f')top-=3;
    }
    res+=top;
    printf("%d\n",res);
}