#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k, x, t, a[55], sum = 0;
  string s;
  cin >> n >> m;
  getchar();
  cin >> s;
  for (i = 0; i < n; i++) a[i] = s[i] - 'a' + 1;
  sort(a, a + n);
  j = 1;
  for (i = 1; i < n; i++)
    if (a[i] != a[i - 1]) j++;
  if (j < m) {
    cout << "-1" << endl;
    return 0;
  }
  sum += a[0];
  m--;
  t = a[0];
  for (i = 1; i < n; i++) {
    if (m == 0) break;
    if (a[i] - t > 1) {
      t = a[i];
      sum += a[i];
      m--;
    }
  }
  if (m == 0)
    cout << sum << endl;
  else
    cout << "-1" << endl;
  return 0;
}
