#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  bool count[26] = {0};
  char c;
  for (int i = 0; i < n; i++) {
    cin >> c;
    count[c - 'a'] = true;
  }
  int e = -4;
  int res = 0;
  for (int i = 0; i < 26; i++) {
    if ((!count[i]) || (i - e) < 2) continue;
    res += i + 1;
    e = i;
    k--;
    if (k == 0) break;
  }
  if (k > 0) {
    cout << "-1\n";
  } else
    cout << res << "\n";
}
