#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, sum = 0, count = 0;
  cin >> n >> k;
  char s[n];
  cin >> s;
  int a[n];
  for (i = 0; i < n; i++) {
    a[i] = s[i] - 'a' + 1;
  }
  sort(a, a + n);
  int l = -1;
  for (i = 0; i < n; i++) {
    if (a[i] - l > 1) {
      l = a[i];
      sum += a[i];
      count++;
      if (count == k) cout << sum, exit(0);
    }
  }
  cout << -1;
}
