#include <bits/stdc++.h>
using namespace std;
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
const int N = 3e5 + 10;
const long long MOD = 1e9 + 7;
const int rx[4] = {-1, 0, 1, 0};
const int ry[4] = {0, 1, 0, -1};
const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int hx[8] = {-2, -2, -1, 1, 2, 2, 1, -1};
const int hy[8] = {-1, 1, 2, 2, 1, -1, -2, -2};
const long double eps = 1e-7;
const double pi = acos(-1.0);
const int INF = 2e9;
int dp[(1 << 20)];
int sum[(1 << 20)][20];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  unordered_map<int, int> kol;
  for (int i = 1; i < n; i++) {
    kol[int(s[i - 1] - 'a') * 1000 + int(s[i] - 'a')]++;
    kol[int(s[i] - 'a') * 1000 + int(s[i - 1] - 'a')]++;
  }
  for (auto it : kol) {
    sum[(1 << (it.first / 1000))][it.first % 1000] = it.second;
  }
  for (int i = 1; i < (1 << m); i++) dp[i] = INF;
  for (int mask = 0; mask < (1 << m); mask++) {
    if (__builtin_popcount(mask) < 2) continue;
    int kol = 0, pos = -1, mask2 = mask;
    while (mask2) {
      if ((mask2 & 1)) {
        pos = kol;
        break;
      }
      kol++;
      mask2 >>= 1;
    }
    for (int i = 0; i < m; i++) {
      if (((mask >> i) & 1) == 1) continue;
      sum[mask][i] = sum[mask ^ (1 << pos)][i] + sum[(1 << pos)][i];
    }
  }
  for (int mask = 0; mask < (1 << m); mask++) {
    int h = __builtin_popcount(mask);
    for (int i = 0; i < m; i++) {
      if (((mask >> i) & 1) == 1) continue;
      dp[mask + (1 << i)] =
          min(dp[mask + (1 << i)],
              dp[mask] + h * sum[mask][i] -
                  h * sum[((1 << m) - 1) ^ (mask | (1 << i))][i]);
    }
  }
  cout << dp[(1 << m) - 1] << endl;
  return 0;
}
