/*
 * Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VB;
typedef double db;

template <class T> void clear(T& a) { T().swap(a);}
template <class T,class S>
inline bool upmin(T& a,const S&b){ return a>b ? a=b,1:0;}
template <class T,class S>
inline bool upmax(T&a, const S&b){ return a<b? a=b,1:0;}

//fast read(improved by fread)
char buf[1<<21],*p1=buf,*p2=buf;
inline int getc(){
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
}
inline int redi() {
    int ret = 0,f = 0;char ch = getc();
    while (!isdigit (ch)) {
        if (ch == '-') f = 1;
        ch = getc();
    }
    while (isdigit (ch)) {
        ret = ret * 10 + ch - 48;
        ch = getc();
    }
    return f?-ret:ret;
}

//global variable
const int N = 1;
const int mod = 1e9+7;
const double eps = -1e-12;
int n;
long double a,b,m;
//


//code from here! Come on! Have a pleasant experience~
int main()
{
    IO;
    cin>>n>>m;

    long double res = m;

    rep(i,1,n){
        cin>>a>>b;
        res -= (a * b/100.0);
        // cout<<res<<endl;
        if(res<eps){
            cout<<i<<endl;
            return 0;
        }
    }   
    cout<<"-1"<<endl;
    return 0;
}
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF=1e18;
void chmin(int&a,int b){if(a>b)a=b;}
signed main(){
  int N; cin>>N;
  string S; cin>>S;
  vector<vector<int>> dp(N,vector<int>(26,INF));
  dp[0][S[0]-'a']=0;
  int ans=INF;
  for(int i=0;i<N;i++){
    for(int j=0;j<26;j++)if(S[i]!='a'+j){
      if(i==N-1)chmin(ans,dp[i][j]);
      else chmin(dp[i+1][S[i+1]-'a'],dp[i][j]+1);
    }
    if(i!=N-1){
      for(int j=0;j<26;j++)chmin(dp[i+1][j],dp[i][j]);
    }
  }
  cout<<(ans==INF?-1:ans+1)<<endl;
}