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 ≤ 100, 1 ≤ k ≤ 10^{12}) — 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.util.*;
import java.io.*;

public class Solution
{
       static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(
                new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt != 0) {
                        break;
                    }
                    else {
                        continue;
                    }
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0,
                                 BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
 
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
    static int parent(int x , int p[])
    {
           if(p[x] == x)
           return x;
           
           return (p[x] = parent(p[x],p));
    }
    
    static void union(int a , int b , int p[] , int size[])
    {
           a = parent(a,p);
           b = parent(b,p);
           
           if(size[a] < size[b])
           {
                  int temp = a;
                  a = b;
                  b = temp;
           }
           p[b] = a;
           size[a] += size[b];
    }
    
   
  
  static int max(int x)
  {
         for(int j = 30 ; j >= 0 ; j--)
         {
                if((x&(1<<j)) > 0)
                return j;
         }
         return -1;
  }
  static void dfs(int n , LinkedList<Integer> arr[] , int p , int pp[])
  {
         pp[n] = p;
         for(Integer i : arr[n])
         {
                if(i != p)
                {
                       dfs(i,arr,n,pp);
                }
         }
  }
  
  static void dfs2(int n , LinkedList<Integer> arr[] , int p , int w[] , long dp[] , long max[])
  {
         long mx = 0;
         for(Integer i : arr[n])
         {
                if(i != p)
                {
                       dfs2(i,arr,n,w,dp,max);
                       dp[n] += dp[i]+2*w[i];
                       mx = Math.max(mx,w[i]+max[i]);   
                }
         }
         max[n] = mx;
  }
  
 static int getSum( int index , int BITree[])
{
    int sum = 0; // Iniialize result
  
    // index in BITree[] is 1 more than the index in arr[]
   // index = index + 1;
  
    // Traverse ancestors of BITree[index]
    while (index>0)
    {
        // Add current element of BITree to sum
        sum += BITree[index];
  
        // Move index to parent node in getSum View
        index -= index & (-index);
    }
    return sum;
}
  
// Updates a node in Binary Index Tree (BITree) at given index
// in BITree. The given value 'val' is added to BITree[i] and 
// all of its ancestors in tree.
static void updateBIT(int n, int index, int val , int BITree[])
{
    // index in BITree[] is 1 more than the index in arr[]
    //index = index + 1;
  
    // Traverse all ancestors and add 'val'
    while (index <= n)
    {
    // Add 'val' to current node of BI Tree
    BITree[index] += val;
  
    // Update index to that of parent in update View
    index += index & (-index);
    }
}

static long inv(int arr[])
{
       int n = arr.length;
       int bit[]  = new int[n+1];
       long ans = 0;
       for(int i = 0 ; i < n; i++)
       {
              updateBIT(n,arr[i],1,bit);
              ans += getSum(n,bit)-getSum(arr[i],bit);
       }
       return ans;
}
static double dp[][];
static boolean vis[][];


       public static void main(String []args) throws IOException
       {
              Scanner sc = new Scanner(System.in);
              int n = sc.nextInt();
              long k = sc.nextLong();
              
              long dp[][] = new long[n][n+1];
              sc.nextLine();
              String s = sc.nextLine();
              int next[][] = new int[n][26];
              for(int i = 0 ; i < 26 ; i++)
              {
                     next[n-1][i] = -1;
              }
              next[n-1][s.charAt(n-1)-'a'] = n-1;
              for(int i = n-2 ; i >= 0 ; i--)
              {
                     for(int j = 0 ; j < 26 ; j++)
                     {
                            next[i][j] = next[i+1][j];
                     }
                     next[i][s.charAt(i)-'a'] = i;
              }
              for(int i = 0 ; i < 26 ; i++)
              {
                     if(next[0][i] != -1)
                     dp[next[0][i]][1] = 1;
              }
              for(int i = 0 ; i  < n-1 ; i++)
              {
                     for(int j = 0 ; j < 26 ; j++)
                     {
                            for(int len = 1 ; len < n ; len++)
                            {
                            if(next[i+1][j] != -1 && dp[next[i+1][j]][len+1] != Long.MAX_VALUE)
                            {
                                   if(dp[i][len] == Long.MAX_VALUE)
                                   dp[next[i+1][j]][len+1] = Long.MAX_VALUE;
                                   
                                   else
                                   dp[next[i+1][j]][len+1] += dp[i][len];
                            }
                            
                            int pos = next[i+1][j];
                            
                            if(pos != -1)
                            {
                            if(dp[pos][len+1] > 1000000000000L)
                            dp[pos][len+1] = Long.MAX_VALUE;
                            }
                            }
                     }
              }
              
              long big[] = new long[n+1];
              big[0] = 1;
              for(int i = 0 ; i < n ; i++)
              {
                     for(int j = 1 ; j <= n ; j++)
                     {
                            if(big[j] != Long.MAX_VALUE)
                            {
                                   if(dp[i][j] == Long.MAX_VALUE)
                                   big[j] = Long.MAX_VALUE;
                                   
                                   else
                                   big[j] += dp[i][j];
                                   
                                   if(big[j] > 1000000000000L)
                                   big[j] = Long.MAX_VALUE;
                            }
                     }
              }
              
              long ans = 0;
              for(int i = n ; i >= 0 ; i--)
              {
                  if(big[i] >= k)
                  {
                          ans += (long)(n-i)*k;
                         k = 0;
                        break;
                  }
                  
                  else
                  {
                         ans += big[i]*(long)(n-i);
                         k -= big[i];
                  }
              }
              
              if(k != 0)
              System.out.println(-1);
               
               else
               System.out.println(ans);
       }
}