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.*;
import java.math.BigInteger;
import java.util.*;
public class l {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMMMM      MMMMMM      OOO      OOO        SSSS   SSS     EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEE           MMMM MMM  MMM MMMM    OOO          OOO    SSSS       SSS   EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM  MMMMMM  MMMM   OOO            OOO   SSSS             EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM  OOO              OOO   SSSSSSS         EEEEE          /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO      SSSSSS       EEEEEEEEEEE    /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO         SSSSSSS   EEEEEEEEEEE    /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM   OOO            OOO              SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM    OOO          OOO     SSS       SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM      OOO      OOO        SSS    SSSS    EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    static int mod = (int) (1e9 + 7);
    // static int n;
    static StringBuilder sol;

    static class pair implements Comparable<pair> {
        int start, exam,days,idx;

        public pair(int x, int y,int z,int id) {
            start = x;
            exam = y;
            days=z;
            idx=id;
        }

        public int compareTo(pair o) {
            return start==o.start?exam-o.exam:start-o.start;
        }

        public String toString() {
            return start + " " + exam+" "+days+" "+idx;
        }
    }
    static Edge[]edges;
    static PriorityQueue<Edge>rem;
    static void kruskal(){
        UnionFind sets = new UnionFind(n);
        Arrays.sort(edges);
      //  long cost=0;
        for (int i =edges.length-1;i>=0;i--){
            Edge cur=edges[i];
            if (sets.findSet(cur.u)==sets.findSet(cur.v)){
                rem.add(cur);
            }else{
                sets.union(cur.u,cur.v);
            //    cost+=cur.w;
            }
        }
        //System.err.println(cost);
    }
    static int n;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        //FileWriter f = new FileWriter("C:\\Users\\Ibrahim\\out.txt");
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        long k = sc.nextLong();
        char[]s= sc.nextLine().toCharArray();
        BigInteger[][]anss= new BigInteger[26][n+1];
        for (int i =0;i<26;i++){
            for (int j =0;j<=n;j++){
                anss[i][j]=BigInteger.ZERO;
            }
        }
        BigInteger[]preans= new BigInteger[n+1];
        for (int i =0;i<=n;i++)preans[i]= BigInteger.ONE;
        for (int seq =2;seq<=n;seq++){
            for (int i =n-1;i>=0;i--){
                int idx=s[i]-'a';
                BigInteger now = BigInteger.ZERO;
                for (int l=0;l<26;l++){
                    now=now.add(anss[l][seq-1]);
                }
                anss[idx][seq-1]=preans[i];
                preans[i]=now;
            }
        }
        boolean[]found= new boolean[26];
        for (int i =0;i<n;i++){
            int idx=s[i]-'a';
            if (!found[idx]){
                anss[idx][n]=preans[i];
                found[idx]=true;
            }
        }
        BigInteger max = BigInteger.valueOf(k);
        BigInteger now = BigInteger.ZERO;
        BigInteger cost= BigInteger.ZERO;
        anss[0][0]=BigInteger.ONE;
        w:for (int i =n;i>=0;i--){
            for (int j=0;j<26;j++){
                if (now.add(anss[j][i]).compareTo(max)>=0){
                    BigInteger z=max.subtract(now);
                    cost=cost.add(z.multiply(BigInteger.valueOf(n-i)));
                    now=max;
                    break w;
                }
                else {
                    now=now.add(anss[j][i]);
                    cost=cost.add(anss[j][i].multiply(BigInteger.valueOf(n-i)));
                }
            }
        }
        if (max.compareTo(now)==0) {
            pw.println(cost);
        }
        else pw.println(-1);
        pw.flush();
    }
    static long gcd(long a, long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    static int inver(long x, int mod) {
        int a = (int) x;
        int e = (mod - 2);
        int res = 1;
        while (e > 0) {
            if ((e & 1) == 1) {
                //System.out.println(res*a);
                res = (int) ((1l * res * a) % mod);
            }
            a = (int) ((1l * a * a) % mod);
            e >>= 1;
        }
        //out.println(res+" "+x);
        return res % mod;
    }
    static class UnionFind {
        int[] p, rank;

        UnionFind(int N)
        {
            p = new int[N];
            rank = new int[N];
            for (int i = 0; i < N; i++)
                p[i] = i;
        }

        int findSet(int x) { return p[x] == x ? x : (p[x] = findSet(p[x])); }

        boolean union(int x, int y)
        {
            x = findSet(x);
            y = findSet(y);
            if(x == y)
                return false;

            if (rank[x] > rank[y])
                p[y] = x;
            else
            {
                p[x] = y;
                if(rank[x] == rank[y])
                    ++rank[y];
            }
            return true;
        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
    static class Edge implements Comparable<Edge>
    {
        int u, v, w,idx;

        Edge(int a, int b, int c,int z) {	u = a; v = b; w = c;idx=z; }

        public int compareTo(Edge e) { return w - e.w; }

        public String toString() {
            return u+" "+v+" "+w+" "+idx;
        }
    }
}