#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
const long long oo = 1e18;
const long long mod = 1e9 + 7;
bool l[26];
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  for (int i = 0; i < n; i++) l[s[i] - 'a'] = 1;
  int ans = -1;
  for (int i = 0; i < 26; i++) {
    if (!l[i]) continue;
    int u = 1, cur = i + 1;
    for (int j = i + 2; j < 26; j++) {
      if (u == k) break;
      if (l[j]) {
        cur += j + 1;
        j++;
        u++;
      }
    }
    if (u == k) {
      if (ans == -1) ans = cur;
      ans = min(ans, cur);
    }
  }
  cout << ans << endl;
}
