#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n = 0, k = 0;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    a[i] = s[i] - 'a' + 1;
  }
  sort(a.begin(), a.end());
  if (k == 1) {
    cout << a[0];
    return 0;
  }
  long long ans = a[0], prev = 0, prevval = a[0], count = 1;
  for (long long i = 1; i < n; i++) {
    if ((a[i] - prevval) > 1) {
      ans += a[i];
      prev = i;
      prevval = a[i];
      count++;
    }
    if (count == k) {
      cout << ans;
      return 0;
    }
  }
  cout << -1;
  return 0;
}
