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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.time.temporal.JulianFields;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.JLabel;

public class answertillD {
	static int minn;

	static class pair implements Comparable<pair> {
		int u;
		int v;

		public pair(int uo, int vo) {
			u = uo;
			v = vo;

		}

		@Override
		public String toString() {
			return "pair [u=" + u + ", v=" + v + "]";
		}

		@Override
		public int compareTo(pair e) {
			if (u == e.u && v == e.v)
				return 0;
			if (u > e.u || e.u > u)
				return u - e.u;
			else
				return 1;
		}
	}

	static class edge implements Comparable<edge> {
		int u;
		int v;
		int w;

		@Override
		public String toString() {
			return "edge [u=" + u + ", v=" + v + ", w=" + w + "]";
		}

		public edge(int uo, int vo, int wo) {
			u = uo;
			v = vo;
			w = wo;
		}

		@Override
		public int compareTo(edge e) {
			// TODO Auto-generated method stub
			return w - e.w;
		}
	}

	public static long power(long x, long y) {
		long ans = 1;
		while (y-- > 0) {
			if (ans <= 1e18 / x)
				ans *= x;
			else {
				ans = Long.MAX_VALUE;
				break;
			}
		}
		return ans;
	}

	public static char[][] reb() {
		int n = smallArr.length;
		char[][] arr = new char[n][n];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				arr[i][j] = smallArr[n - j - 1][i];

		return arr;
	}

	static char[] Arr, cost, level;
	static char[][] smallArr;
	static int[][][] memo;
	static int n;
	static long S;
	static final int VISITED = 2, EXPLORED = 1, UNVISITED = 0;
	static ArrayList<Integer>[] adjList;
	static boolean[] visited, adjMat[];
	static int V, E;

	static long bfs(String str, int k) {
		Queue<String> q = new LinkedList<String>();
		q.add(str);
		HashSet<String> hs = new HashSet<String>();
		hs.add(str);
		HashMap<String, Integer> hm = new HashMap<String, Integer>();
		hm.put(str, 0);
		long ans = 0;
		while (k > 0 && !q.isEmpty()) {
			String u = q.remove();
			for (int v = 0; v < u.length() ; v++) {
				String sam = u.substring(0, v) + u.substring(v + 1);
				if (!hm.containsKey(sam)) {
					int x = hm.get(u) + 1;
					hm.put(sam, x);
					k--;
					ans += x;
					if (k == 0)
						break;
					q.add(sam);
				}
			}

		}
		if (k != 0)
			return -1;
		return ans;

	}

	public static long GCD(long a, long b) {
		if (b == 0)
			return a;
		return GCD(b, a % b);
	}

	public static long powerlog(long x, long y) {
		long res = 1; // Initialize result
		while (y > 0) {
			if ((y & 1) == 1)
				res = (res * x);
			// res %= 998244353;
			y = y >> 1; // y = y/2
			x = (x * x);
			// x %= 998244353;
		}
		return res;
	}

	public static String rev(String str) {
		StringBuilder sb = new StringBuilder();
		for (int i = str.length() - 1; i >= 0; i--) {
			sb.append(str.charAt(i));
		}
		return sb + "";
	}

	public static boolean checj(int numa, int b, int a, int n, int k) {
		int numb = n - numa;
		if (k % a == 0) {
			if (k / a - 1 < numa)
				return false;
		} else {
			if (k / a < numa)
				return false;
		}
		k -= numa * a;
		if (k % b == 0) {
			if (k / b - 1 < numb)
				return false;
		} else {
			if (k / b < numb)
				return false;
		}
		return true;
	}

	public static int dp(int previdx, int idx, int rem) {
		if (rem == 0)
			return 0;
		if (idx == n)
			return (int) -(1e9);
		if (memo[previdx][idx][rem] != -1)
			return memo[previdx][idx][rem];
		int remove = 0;
		int leave = dp(idx, idx + 1, rem);
		if (leave < 0)
			leave = 0;
		if (previdx == n || Arr[previdx] != Arr[idx])
			remove = 1 + dp(previdx, idx + 1, rem - 1);
		if (remove < 0)
			remove = 0;
		return memo[previdx][idx][rem] = leave + remove;
	}

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		// long ahmed=power(2, 64);
		// System.out.println(ahmed);

		n = sc.nextInt();
		int k = sc.nextInt() - 1;
		String str = sc.next();
		pw.println(bfs(str, k));
		pw.close();
	}

	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 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();
		}

	}

}
