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.util.*;

import javax.swing.plaf.synth.SynthSeparatorUI;
public class Problem3 {
	static Scanner sc=new Scanner(System.in);
	static PrintWriter out=new PrintWriter(System.out);
	public static void main(String[] args) throws IOException, InterruptedException {
		int n=sc.nextInt();
		int k=sc.nextInt();
		String s=sc.nextLine();
		int cost=0;
		HashSet<String>set=new HashSet<>();
		int j=0;
		Queue<String> q=new LinkedList<String>();
		
		set.add(s);
		q.add(s);
		while(set.size()<k&&!q.isEmpty()) {
		s=q.poll();
			for(int i=0 ; i<s.length() ;i++) {
			String temp = s.substring(0,i) + s.substring(i+1);
			if(set.size()>=k) {
				break;
			}
			if(!set.contains(temp)) {
				q.add(temp);
				
				set.add(temp);
				cost+=n-temp.length();
			}
		}
		j++;
		}
		if(set.size()<k) {
			cost=-1;
		}
		
		System.out.println(cost);
	}
	private static boolean check(int k, int mid, int a, int b,int n) {
		long normal=n-mid;
		long cost1=1l*normal*1l*b*1l;
		long cost2=1l*mid*1l*a*1l;
		if(cost1+cost2>=k)
		return false;
		else
			return true;
	}
	static long pow(long a, int n,int mod)
	{
		long res = 1;
		while(n != 0)
		{
			if((n & 1) == 1)
				res = (res*(a%mod))%mod;
			a *= (a%mod);
			a=a%mod;
			n >>= 1;			
		}
		return res;
	}
	static TreeSet<Integer> primes;
	static int[] isComposite;

	static void sieve(int N)	// O(N log log N) 
	{
		isComposite = new int[N+1];					
		isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
		primes = new TreeSet<Integer>();

		for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N)) 
			if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if(1l * i * i <= N)
					for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
						isComposite[j] = 1;
			}   
	}
	static int INF=(int) 1E9;
	static class Pair{
		int x;
		int y;
		public Pair(int x,int y) {
			this.x=x;
			this.y=y;
		}
		
	}
	public static int[] schuffle(int a[]) {
		for (int i = 0; i < a.length; i++) {
			int x=(int)(Math.random()*a.length);
		int temp=a[x];
		a[x]=a[i];
		a[i]=temp;
		}
		return a;
	}
	static long gcd(long min,long a) {
		if(a==0) {
			return min;
		}
		return gcd(a,min%a);
	}
static int 	factprime(int n,int p) {
	int pow=0;
	for(int i=p ; i<=n ; i=i*p) {
		pow+=n/i;
	}
	return pow;
}
static long power(long x, long y) 
{ 
    long temp; 
    if( y == 0) 
        return 1; 
       
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return ((temp%10)*(temp)%10)%10; 
    else
        return ((x%10)*(temp%10)*(temp%10))%10;
}  
	static ArrayList<Integer> adj[];
static Stack<Integer> st=new Stack<>();
static  boolean visited[];
static void dfs(int i){
	visited[i]=true;
	st.add(i);
	for(int x:adj[i]) {
		if(!visited[x])
			dfs(x);
	}
}


	static  class Scanner {
	StringTokenizer st;
	BufferedReader br;

	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 int[] nextIntArr(int n) throws IOException {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
			arr[i] = nextInt();
		return arr;
	}

	public long[] nextLongArr(int n) throws IOException {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
			arr[i] = nextLong();
		return arr;
	}

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

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

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}
	public void waitForInput() throws InterruptedException {Thread.sleep(2300);}
}



static class SegmentTree {
	int N; // number of elements in my array after the padding
	int [] array, sTree, lazy; 
	SegmentTree(int []inp){
		N = inp.length - 1;
		array = inp;
		sTree =  new int[N<<1];
		lazy =  new int[N<<1];
		build(1, 1, N);
	}
	void build(int node, int b, int e) {
		if(b == e) {
			//node = b + N - 1
			// update(idx , value)
			// sTree[idx + N - 1] += value
			sTree[node] = array[b];
		}
		else {
			int nodeLeft = node << 1;
			int nodeRight = (node << 1)+1;
			int mid = (b + e) >> 1;
			build(nodeLeft, b , mid);
			build(nodeRight, mid + 1, e);
			sTree[node] = sTree[nodeLeft] + sTree[nodeRight];
		}
	}
	void propagate(int node, int b, int e) {
		int leftChild = node << 1;
		int rightChild = node<<1|1;
		lazy[leftChild] += lazy[node];
		lazy[rightChild] += lazy[node];
		int mid = (b + e)>>1;
		if(lazy[node]%2!=0) {
		sTree[leftChild] = (mid - b + 1)-sTree[leftChild];
		sTree[rightChild] =(e - mid)-sTree[rightChild];
		}
		lazy[node] = 0;
	}
	// add value v for element in position idx in my input array
	//O(log(N))
	void update_point(int idx, int v) {
		int node = idx + N - 1;
		sTree[node] += v;
		while(node > 1) {
			node >>= 1;
			sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
		}
	}
	// O(log(N))
	int query(int i, int j) {
		return query(1, 1, N, i, j); 
	}
	int query(int node, int b, int e, int i, int j) {
		
		
		if(i > e || j < b)
			return 0;
		if(b >= i && e <= j)
			return sTree[node];
		int mid = (b + e) >> 1;
		propagate(node, b, e);
        int q1 = query(node << 1, b, mid, i , j);
		int q2 = query(node<<1|1, mid + 1, e, i, j);
		return q1 + q2;
		
		
	}
	void update_range(int i, int j) { //O(log(N))
		update_range(1, 1, N, i, j); 
	}
	void update_range(int node, int b, int e, int i, int j) {
		if(i > e || j < b)
			return;
		if(b >= i && e <= j) {
			sTree[node] = (e - b + 1)-sTree[node];
			lazy[node]+=1;
		}
		else {
			int mid = (b + e) >> 1;
			propagate(node, b, e);
			update_range(node<<1, b , mid, i, j);
			update_range(node<<1|1, mid+1, e, i, j);
			sTree[node] = sTree[node<<1] + sTree[node<<1|1];
		}
	}
}
}

	

