#include <bits/stdc++.h>
using namespace std;
int n, k;
char N[55];
int main() {
  cin >> n >> k;
  scanf("%s", N);
  sort(N, N + n);
  {
    int last = 0, all = 1, sum = N[0] + 1 - 'a';
    for (int i = 1; i < n && all < k; i++) {
      if (N[i] - N[last] > 1) {
        sum = sum + N[i] - 'a' + 1;
        last = i;
        all++;
      }
    }
    if (all < k)
      cout << "-1" << endl;
    else
      cout << sum << endl;
  }
  return 0;
}
