#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  char r[n], s[k];
  int a[n], c = 0;
  for (int i = 0; i < n; i++) {
    cin >> r[i];
    a[i] = r[i];
  }
  int key, j;
  for (int i = 1; i < n; i++) {
    key = a[i];
    j = i - 1;
    while (j >= 0 && a[j] > key) {
      a[j + 1] = a[j];
      j = j - 1;
    }
    a[j + 1] = key;
  }
  int w = a[0] - 96;
  c = 1;
  for (int i = 1, j = 0; i < n;) {
    if (a[i] - a[j] >= 2 && c < k) {
      w = w + a[i] - 96;
      c++;
      i++;
      j = i - 1;
    } else {
      i++;
    }
    if (c == k) break;
  }
  if (c < k)
    cout << "-1";
  else {
    cout << w;
  }
  return 0;
}
