#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  char a[n];
  cin >> a;
  sort(a, a + n);
  int j = 0;
  int last = -1;
  int d = 0;
  long int cnt = 0;
  if (n == 1) {
    cout << a[0] - 'a' + 1;
    return 0;
  }
  while (j != n && k != 0) {
    d = a[j] - 'a' + 1;
    if (d - last > 1) {
      k--;
      last = d;
      cnt += d;
    }
    j++;
  }
  if (k != 0)
    cout << -1;
  else
    cout << cnt;
}
