#include <bits/stdc++.h>
using namespace std;
int n, m, same;
char c1, c2;
signed main() {
  scanf("%d%d", &n, &m);
  while (!isalpha(c1)) c1 = getchar();
  long long ans = n * (m - 1);
  for (int i = 1; i < n; ++i) {
    char c = getchar();
    same = (c == c2) ? same + 1 : 0;
    if (c != c1) ans += n * (m - 1) - same - 1;
    c2 = c1;
    c1 = c;
  }
  return !printf("%lld", ans);
}
