#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;

	int a[n], b[n];
	vector <ll> v;
	ll sum = 0;

	for(int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		v.push_back(2LL * a[i] + b[i]);
		sum += a[i];
	}

	sort(v.begin(), v.end(), greater<ll> ());
	for(int i = 0; i < n; i++) {
		if(v[i] > sum) {
			cout << i + 1;
			return 0;
		}
		sum -= v[i];
	}
	assert(0);
}
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rl register long long
ll n,x,cur,ta,tb;
int main(){
    scanf("%lld %lld",&n,&x);x*=100;
    for(rl i=1;i<=n;++i){
        scanf("%lld %lld",&ta,&tb);
        cur+=ta*tb;
        if(cur>x) return printf("%lld\n",i),0;
    }
    printf("-1\n");
    return 0;
}