#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  int n, k;
  cin >> n >> k >> s;
  int a[26] = {0};
  int b[26] = {0};
  for (int i = 0; i < n; i++) {
    a[s[i] - 'a'] = 1;
  }
  int cnt = 0;
  int ans = 0;
  if (a[0] != 0) {
    cnt = 1;
    ans = 1;
    b[0] = 1;
  }
  for (int i = 1; cnt < k && i < 26; i++) {
    if (b[i - 1] == 1) continue;
    if (a[i] != 0) {
      cnt++;
      ans += i + 1;
      b[i] = 1;
    }
  }
  if (cnt == k) {
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
}
