#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long MAXN = 1e+2 + 7;
const long long MOD = 998244353, INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
double EPS = 1e-9;
double PI = acos(-1);
vector<long long> adj[MAXN];
long long visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1},
    dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
long long t, n;
long long i, j = 0;
long long a[200007], b[200007], val[200007];
string second, e;
long long k = 0, w;
long long count1;
long long sum = 0;
long long subt(long long a, long long b) { return (a - b + MOD) % MOD; }
long long mult(long long a, long long b) { return (a * b) % MOD; }
long long add(long long a, long long b) { return (a + b) % MOD; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  cin >> n >> k >> second;
  long long len1 = 1;
  sort(second.begin(), second.end());
  long long len = second.size();
  long long q = 1;
  count1 += second[i] - 96;
  for (i = 1; i < len; i++) {
    if (len1 == k) break;
    if (second[i] - second[q - 1] >= 2) {
      count1 += second[i] - 96;
      q = i + 1;
      len1++;
    }
  }
  if (len1 == k)
    cout << count1;
  else
    cout << -1;
}
