#include <bits/stdc++.h>
using namespace std;
char str[100005];
long long res = 0;
int main() {
  int n, m, i, k, j, K = 0;
  scanf("%d%d%s", &n, &m, str + 1);
  for (i = 1; i < n; i++)
    if (str[i] != str[i + 1]) K++;
  for (i = 1; i < n; i++) {
    if (str[i] == str[i + 1]) continue;
    int las = i;
    while (i + 2 <= n && str[i] == str[i + 2]) i++;
    las = i - las + 1;
    res += 1ll * las * (las + 1) / 2;
  }
  cout << 1ll * (K + 1) * (m - 1) * n - res << endl;
  return 0;
}
