#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string A;
  cin >> A;
  bitset<28> alpha;
  for (int i = 0; i < n; ++i) {
    alpha[A[i] - 'a'] = 1;
  }
  for (int i = 0; i < 26; ++i) {
    if (alpha[i] == 1) {
      alpha[i + 1] = 0;
    }
  }
  int ans = 0, add = 0;
  for (int i = 0; i < 26 && add < m; ++i) {
    if (alpha[i]) {
      ++add;
      ans += (i + 1);
    }
  }
  if (add < m) {
    cout << -1 << "\n";
  } else {
    cout << ans << "\n";
  }
  return 0;
}
