#include <bits/stdc++.h>
using namespace std;
bool vis[120000];
int main() {
  int n, k;
  cin >> n >> k;
  getchar();
  for (int i = 1; i <= n; i++) {
    char ch = getchar();
    vis[ch - 'a'] = true;
  }
  int cnt = 1, at, ans = 0;
  for (int i = 0; i < 26; i++)
    if (vis[i]) {
      at = i;
      ans = i + 1;
      break;
    }
  while (1) {
    bool flag = false;
    if (cnt == k) break;
    for (int i = at + 2; i < 26; i++) {
      if (vis[i] == true) {
        cnt++;
        at = i;
        ans += i + 1;
        flag = true;
        goto L1;
      }
    }
  L1:
    if (cnt == k) break;
    if (flag == false) {
      puts("-1");
      return 0;
    }
  }
  cout << ans;
}
