#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k; cin >> n >> k;
    string s; cin >> s;
    if (n<=5 && k==2)
    {
        if (n==1)
        {
            cout << 1 << endl;
            return 0;
        }
        if (n==2)
        {
            cout << 1 << " ";
            if (s=="aa" || s=="bb")
            {
                cout << 1 << endl;
            }
            else
                cout << 2 << endl;
            return 0;
        }
        if (n==3)
        {
            cout << 1 << " ";
            string a=s.substr(0, 2);
            if (a=="aa" || a=="bb") cout << 1 << " ";
            else cout << 2 << " ";
            if (s=="aaa" || s=="bbb")
                cout << 1 << endl;
            else cout << 2 << endl;
            return 0;
        }
        if (n==4)
        {
            cout << 1 << " ";
            string a=s.substr(0, 2);
            if (a=="aa" || a=="bb") cout << 1 << " ";
            else cout << 2 << " ";
            a=s.substr(0, 3);
            if (a=="aaa" || a=="bbb") cout << 1 << " ";
            else cout << 2 << endl;
            if (s=="aaaa" || s=="bbbb")
                cout << 1 << endl;
            else if (s=="abba")
                cout << 3 << endl;
            else
                cout << 2 << endl;
            return 0;
        }
        if (n==5)
        {
            cout << 1 << " ";
            string a=s.substr(0, 2);
            if (a=="aa" || a=="bb") cout << 1 << " ";
            else cout << 2 << " ";
            a=s.substr(0, 3);
            if (a=="aaa" || a=="bbb") cout << 1 << " ";
            else cout << 2 << " ";
            a=s.substr(0, 4);
            if (a=="aaaa" || a=="bbbb") cout << 1 << " ";
            else if (a=="abba") cout << 3 << " ";
            else cout << 2 << " ";
            if (s=="aaaaa" || s=="bbbbb")
            {
                cout << 1 << endl;
                return 0;
            }
            int bra=0, brb=0;
            for (int i=0; i<n; i++)
            {
                if (s[i]=='a') bra++;
                else brb++;
            }
            if (brb==1 || s=="aabbb" || s=="bbbaa"
                || s=="bbaaa" || s=="aaabb")
            {
                cout << 2 << endl;
                return 0;
            }
            cout << 3 << endl;
            return 0;
        }
    }
    return 0;
}