#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const long long mos = 0x7FFFFFFF;
const long long nmos = 0x80000000;
const int inf = 0x3f3f3f3f;
template <typename T>
inline T read(T& x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x = f ? -x : x;
}
const int maxn = 50;
int a[maxn];
int main() {
  int n, k;
  string str;
  cin >> n >> k >> str;
  for (int i = 0; i < n; i++) {
    int tmp = str[i] - 'a' + 1;
    a[tmp]++;
  }
  int cnt = 0;
  int sum = 0;
  for (int i = 1; i <= 26; i++) {
    if (a[i] > 0) {
      sum += i;
      cnt++;
      i++;
      if (cnt == k) break;
    }
  }
  if (cnt == k) {
    printf("%d\n", sum);
  } else
    puts("-1");
  return 0;
}
