#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(26);
  for (long long i = 0; i < n; i++) {
    char c;
    cin >> c;
    v[c - 'a']++;
  }
  for (long long i = 0; i < 26; i++) {
    if (v[i] != 0) {
      long long sum = 0, kk = 0;
      for (long long j = i; j < 26;) {
        if (v[j] != 0) {
          sum += (j + 1);
          kk++;
          j += 2;
        } else
          j++;
        if (kk == k) {
          cout << sum;
          return 0;
        }
      }
    }
  }
  cout << -1;
  return 0;
}
