#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
string s;
long long n, m, cost;
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int lst = 0;
  cin >> n >> m >> s;
  --m;
  for (int i = 1; i < n; ++i) {
    if (s[i] == s[i - 1])
      cost += n * m, lst = i;
    else if (i > 1 && s[i] != s[i - 2])
      lst = i - 1;
    cost += i - lst;
  }
  cout << (-cost) + n * n * m << endl;
  return 0;
}
