#include <iostream>
#include <vector>
using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;
    vector<int> sed;

    char a;
    for (int i = 0; i < n; i++) {
        cin >> a;
        sed.push_back(a - 96);
    }

    for (int i = 1; i <= n; i++) {
        int x[k];
             for (int j = 0; j < k; j++) {
            x[j] = 0;
        }

        for (int e = 0; e < i; e++){
            for (int j = 0; j < k; j++) {

                if (sed[e] == j + 1) {
                    x[j]++;
                }
            }
        }
        int min = x[0];
            for (int g = 1; g < k; g++) {
                if (min > x[g]) min = x[g];
            }
        cout << min + 1 << " ";

    }
}