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