#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int a[N];
int read() {
  int x = 0, f = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) f |= (ch == '-');
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + (ch ^ 48);
  x = f ? -x : x;
  return x;
}
int main() {
  int n = read(), k = read();
  char ch;
  for (int i = 1; i <= n; ++i) {
    cin >> ch;
    a[i] = ch - 'a' + 1;
  }
  sort(a + 1, a + 1 + n);
  int last = -1, res = 0, sum = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] > last + 1) {
      res++;
      sum += a[i];
      last = a[i];
    }
    if (res == k) return printf("%d\n", sum), 0;
  }
  return printf("-1\n"), 0;
}
