#include <bits/stdc++.h>
using namespace std;
const int maxn = 800010;
int num[28] = {0};
int main() {
  char str[55];
  int m, n;
  scanf("%d%d", &m, &n);
  scanf("%s", str);
  for (int i = 0; i != m; i++) {
    if (num[str[i] - 'a' + 1] == 0) num[str[i] - 'a' + 1] = 1;
  }
  int sum = 0;
  int ans = 0;
  for (int i = 1; i <= 26; i++) {
    if (num[i] == 1) {
      ans += i;
      sum++;
      num[i + 1] = 0;
    }
    if (sum == n) break;
  }
  if (sum < n)
    printf("-1");
  else
    printf("%d", ans);
  return 0;
}
