#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, k;
  int num[100] = {0}, ans[100] = {0};
  char p;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> p;
    num[i] = p - 'a' + 1;
  }
  sort(num, num + n);
  ans[0] = num[0];
  int sum = num[0];
  int j = 1;
  for (int i = 1, j = 1; i < k; i++, j++) {
    while (num[j] - ans[i - 1] <= 1) {
      if (j >= n - 1) {
        sum = -1;
        break;
      }
      j++;
    }
    if (sum == -1) break;
    ans[i] = num[j];
    sum += num[j];
  }
  cout << sum << endl;
  return 0;
}
