#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, w, i = 0, j;
  cin >> n >> k;
  char s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  sort(s, s + n);
  if ((s[0] == s[n - 1]) && k != 1) {
    cout << "-1";
    exit(0);
  }
  if (((n == k) && (s[0] + 1 == s[1])) || k > 13) {
    cout << "-1";
    exit(0);
  }
  w = s[0] - 96;
  k--;
  if (k == 0) {
    cout << w;
    exit(0);
  }
  for (j = 1; j < n; ++j) {
    if ((s[i] + 1 != s[j]) && (s[i] != s[j])) {
      w += (s[j] - 96);
      k--;
      i = j;
    }
    if (k == 0) break;
  }
  cout << w;
  return 0;
}
