#include <bits/stdc++.h>
using namespace std;
bool letter[26];
int main() {
  int N, M, ans = 0;
  char c;
  memset(letter, 0, sizeof(letter));
  scanf("%d %d", &N, &M);
  for (int i = 0; i < N; i++) {
    scanf(" %c", &c);
    letter[c - 'a'] = 1;
  }
  for (int i = 0; i < 26; i++) {
    if (letter[i] && M) {
      ans += i + 1;
      i++;
      M--;
    }
  }
  if (M)
    printf("-1\n");
  else
    printf("%d\n", ans);
  return 0;
}
