#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i;
  cin >> n >> k;
  string a;
  cin >> a;
  int arr[26] = {0}, arr1[26];
  for (i = 0; i < n; i++) {
    arr[a[i] - 97] = 1;
  }
  for (i = 0; i < 26; i++) {
    arr1[i] = i + 1;
  }
  int x = 1, c = 0, p = 0;
  int sum = 0;
  for (i = 0; i < 26; i++) {
    if (arr[i] == 1) {
      p = i;
      sum = arr1[i];
      break;
    }
  }
  if (x == k) {
    cout << sum;
    return 0;
  }
  for (i = p + 1; i < 26; i++) {
    if (arr[i] == 1) {
      if (c >= 1) {
        sum += arr1[i];
        x++;
        if (x == k) {
          cout << sum;
          return 0;
        }
        c = 0;
      } else {
        c++;
      }
    } else {
      c++;
    }
  }
  cout << -1;
  return 0;
}
