#include <bits/stdc++.h>
int n, m, i, Cnt, LCP;
std::string S;
long long Ans;
int main() {
  std::cin >> n >> m >> S;
  for (i = 1; i < n; ++i) Cnt += S[i - 1] != S[i];
  Ans = (long long)(Cnt + 1) * n * (m - 1);
  for (i = 1; i < n; ++i)
    if (!LCP)
      LCP += S[i - 1] != S[i];
    else if (S[i - 2] == S[i])
      ++LCP;
    else {
      Ans -= (long long)(LCP + 1) * LCP >> 1;
      LCP = S[i - 1] != S[i];
    }
  Ans -= (long long)(LCP + 1) * LCP >> 1;
  std::cout << Ans << std::endl;
}
