#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  char s;
  int a[1005];
  while (cin >> n >> k) {
    for (int i = 0; i < n; i++) {
      cin >> s;
      s = s - 'a' + 1;
      a[i] = s;
    }
    sort(a, a + n);
    int t = 1;
    int p = a[0];
    int sum = p;
    for (int i = 1; i < n; i++) {
      if (t >= k) break;
      if (a[i] - p > 1) {
        p = a[i];
        sum += a[i];
        t++;
      }
    }
    if (t == k)
      cout << sum << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
