#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> arr;
  for (int i = 0; i < n; i++) {
    int temp = s[i] - 96;
    arr.push_back(temp);
  }
  sort(arr.begin(), arr.end());
  int ctr = 1;
  int sum = arr[0];
  int t = 0;
  for (int i = 1; i < n && ctr < k; i++) {
    if (arr[i] - arr[t] >= 2) {
      ctr++;
      sum += arr[i];
      t = i;
    }
  }
  if (ctr != k)
    cout << "-1";
  else
    cout << sum;
  return 0;
}
