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

#define int         long long
#define ull         unsigned long long
#define ll          long long
#define M           998244353
#define pb          push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp          make_pair
#define lb          lower_bound
#define ub          upper_bound
#define F           first
#define S           second
#define rep(i, begin, end) for (int i=begin;i<end;i++)
#define repd(i, begin, end) for (int i=end-1;i>=begin;i--)
#define ini(a,n,b)  for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)     __builtin_popcountll(a)
#define hell        1000000007
#define re          resize
const int INF=1e18;
const int N=3e5+5;


int powm(int a,int b,int c)
{
  int res=1;
  while(b)
  {
    if(b&1) 
    res=(res*a)%c;
      a=(a*a)%c;
      b>>=1;
  }
 
  return res;
}
int pow(int a,int b)
{
  int res=1;
  while(b)
  {
    if(b&1) 
    res=(res*a);
      a=(a*a);
      b>>=1;
  }
 
  return res;
}


signed main(void)
{ios
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);freopen("answer.txt", "w", stdout);
    #endif

    
    int n,m;
    cin>>n>>m;
    int p=powm(10,n,m*m);
    int ans=(p/m)%m;
    cout<<ans<<endl;
    
  
}
#include<bits/stdc++.h>
#define int long long
#define inf 999999999999
#define N 100000
using namespace std;
int n,dp[N+1],g[27];
string s;
signed main(){
//	freopen("optimize0.in","r",stdin);
//	freopen("optimize.out","w",stdout);
	cin>>n;
	cin>>s;
	for(int i=1;i<=n;i++)dp[i]=inf;
	for(int i=0;i<26;i++)g[i]=inf;
	for(int i=1;i<=n;i++){
	g[s[i-1]-'a']=min(g[s[i-1]-'a'],dp[i-1]);
		for(int j=0;j<26;j++){
			if(j!=s[i-1]-'a')dp[i]=min(dp[i],g[j]);
		}
		dp[i]++;
	}
	if(dp[n]<inf)cout<<dp[n]<<endl;
	else cout<<-1<<endl;
	return 0;
}
/*

*/