The only difference between the easy and the hard versions is constraints.

A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are not required to go successively, there can be any gaps between them. For example, for the string "abaca" the following strings are subsequences: "abaca", "aba", "aaa", "a" and "" (empty string). But the following strings are not subsequences: "aabaca", "cb" and "bcaa".

You are given a string s consisting of n lowercase Latin letters.

In one move you can take any subsequence t of the given string and add it to the set S. The set S can't contain duplicates. This move costs n - |t|, where |t| is the length of the added subsequence (i.e. the price equals to the number of the deleted characters).

Your task is to find out the minimum possible total cost to obtain a set S of size k or report that it is impossible to do so.

Input

The first line of the input contains two integers n and k (1 ≤ n, k ≤ 100) — the length of the string and the size of the set, correspondingly.

The second line of the input contains a string s consisting of n lowercase Latin letters.

Output

Print one integer — if it is impossible to obtain the set S of size k, print -1. Otherwise, print the minimum possible total cost to do it.

Examples

Input


4 5
asdf


Output


4


Input


5 6
aaaaa


Output


15


Input


5 7
aaaaa


Output


-1


Input


10 100
ajihiushda


Output


233

Note

In the first example we can generate S = { "asdf", "asd", "adf", "asf", "sdf" }. The cost of the first element in S is 0 and the cost of the others is 1. So the total cost of S is 4.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ESubsequencesEasyVersion solver = new ESubsequencesEasyVersion();
        solver.solve(1, in, out);
        out.close();
    }

    static class ESubsequencesEasyVersion {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt();
            long ans = 0, k = s.nextLong();
            TreeSet<Character> t = new TreeSet<>();
            BigInteger dp[] = new BigInteger[n + 1], sum = new BigInteger("1"), kk = new BigInteger(Long.toString(k));
            char[] c = s.next().toCharArray();
            for (char i : c) t.add(i);
            dp[0] = new BigInteger("1");
            for (int i = 2; i <= n; i++) {
                dp[i] = solution(c, i);
                sum = sum.add(dp[i]);
            }
            dp[1] = new BigInteger(Integer.toString(t.size()));
            sum = sum.add(dp[1]);
            //w.println(sum.toString());
            if (sum.compareTo(kk) < 0) {
                w.println(-1);
                return;
            }
            for (int i = n; i >= 0; i--) {
                //w.print(dp[i].compareTo(kk));
                if (dp[i].compareTo(kk) >= 0) {
                    w.println(ans += (n - i) * k);
                    return;
                }
                ans += (n - i) * Long.parseLong(dp[i].toString());
                k -= Long.parseLong(dp[i].toString());
                kk = new BigInteger(Long.toString(k));
            }
        }

        BigInteger solution(char c[], int k) {
            // seiz of the vector
            // which does is constant
            int N = c.length;

            if (N == k)
                return new BigInteger("1");

            // Prepare arrays for recursion
            BigInteger[] v1 = new BigInteger[N];
            BigInteger[] v2 = new BigInteger[N];
            BigInteger[] v3 = new BigInteger[26];
            Arrays.fill(v1, new BigInteger("0"));
            Arrays.fill(v2, new BigInteger("0"));
            Arrays.fill(v3, new BigInteger("0"));

            // initiate separately for k = 1
            // intiate the last element
            v2[N - 1] = new BigInteger("1");
            v3[c[N - 1] - 'a'] = new BigInteger("1");

            // initiate all other elements of k = 1
            for (int i = N - 2; i >= 0; i--) {

                // initialize the front element
                // to vector v2
                v2[i] = v2[i + 1];

                // if element v[a[i]-1] is 0
                // then increment it in vector v2
                if (v3[c[i] - 'a'].equals(new BigInteger("0"))) {
                    v2[i] = v2[i].add(new BigInteger("1"));
                    v3[c[i] - 'a'] = new BigInteger("1");
                }
            }

            // iterate for all possible values of K
            for (int j = 1; j < k; j++) {

                // fill the vectors with 0
                Arrays.fill(v3, new BigInteger("0"));

                // fill(v1.begin(), v1.end(), 0)
                // the last must be 0 as from last no unique
                // subarray can be formed
                v1[N - 1] = new BigInteger("0");

                // Iterate for all index from which unique
                // subsequences can be formed
                for (int i = N - 2; i >= 0; i--) {

                    // add the number of subsequence formed
                    // from the next index
                    v1[i] = v1[i + 1];

                    // start with combinations on the
                    // next index
                    v1[i] = v1[i].add(v2[i + 1]);

                    // Remove the elements which have
                    // already been counted
                    v1[i] = v1[i].subtract(v3[c[i] - 'a']);

                    // Update the number used
                    v3[c[i] - 'a'] = v2[i + 1];
                }

                // prepare the next iteration
                // by filling v2 in v1
                v2 = v1.clone();
            }

            // last answer is stored in v1
            return v1[0];
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }

            while (!isSpaceChar(c));
            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

