#include <bits/stdc++.h>
using namespace std;
int n, k;
string str;
int a[55];
int dp[55][55];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  cin >> str;
  for (int i = 0; i < n; i++) a[i + 1] = 1 + str[i] - 'a';
  sort(a + 1, a + n + 1);
  int mi = 99999999;
  int j = 1;
  int num = 0;
  int last = -1;
  int sum = 0;
  while (j <= n && num < k) {
    if (a[j] - last > 1) {
      sum += a[j];
      last = a[j];
      num++;
    }
    j++;
  }
  if (num == k)
    mi = min(mi, sum);
  else
    mi = -1;
  cout << mi << endl;
  return 0;
}
