#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string a;
  cin >> a;
  int b[26];
  memset(b, 0, sizeof(b));
  for (int j = 0; j < n; j++) {
    b[a[j] - 'a']++;
  }
  cout << "\n";
  int i = 0;
  int s = 0;
  int q = 0;
  while (i < 26) {
    if (b[i]) {
      s += i + 1;
      q++;
      i++;
    }
    if (q == k) {
      i = 26;
      break;
    }
    i++;
  }
  if (q == k) {
    cout << s;
    return 0;
  }
  cout << "-1";
  return 0;
}
