#include <bits/stdc++.h>
using namespace std;
const int mx = 55;
int n, k, a[mx];
int cnt[50], sum;
char s[105];
int main() {
  cin >> n >> k;
  int ans = 0;
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    cnt[s[i] - 'a' + 1]++;
  }
  int f = -1;
  for (int i = 1; i <= 26; i++) {
    if (cnt[i] && i > f + 1) {
      ans += i;
      f = i;
      sum++;
    }
    if (sum == k) break;
  }
  if (sum == k)
    cout << ans << endl;
  else
    puts("-1");
  return 0;
}
