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

int main()
{
    int n, i, x, res = 0, count = 0;

    cin >> n >> x;

    int v[n], p[n];

    for (i = 0; i < n; i++)
    {
        cin >> v[i] >> p[i];

        count += (v[i] * p[i]);
        // cout << count << " " << x << " " << res << "\n";
        if (count / 100.0 > x && !res)
        {
            res = i + 1;
        }
    }

    if (res)
    {
        cout << res << "\n";
    }
    else
    {
        cout << "-1\n";
    }
    return 0;
}
#include "bits/stdc++.h"
using namespace std;
#define int long long
const int mod = 1e9 + 7;

const int N = 2005;
vector<int> adj[N];
vector<bool> visited;
int n, m, c;

void dfs(int s) {
	visited[s] = true;
	c++;
	for (int v : adj[s])
		if (!visited[v])
			dfs(v);
}

void test_case() {
	int res = 0;
	cin >> n >> m;
	int u, v;
	for (int i = 0; i < m; i++) {
		cin >> u >> v;
		adj[u].push_back(v);
	}
	for (int i = 1; i <= n; i++) {
		visited.clear();
		visited.resize(n + 1);
		c = 0;
		dfs(i);
		res += c;
	}
	cout << res << "\n";
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	test_case();
	return 0;
}