#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[100000];
int main() {
  cin >> n >> m;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
  }
  long long rv = n * m - n;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      rv += n * m - n;
    }
  }
  long long c = 1;
  for (int i = 1; i < n; i++) {
    if (c == 1) {
      if (a[i] == a[i - 1]) {
        continue;
      } else {
        c++;
      }
    } else {
      if (a[i] == a[i - 2]) {
        c++;
      } else {
        rv -= (c * (c - 1)) / 2;
        if (a[i] == a[i - 1]) {
          c = 1;
        } else {
          c = 2;
        }
      }
    }
  }
  cout << rv - (c * (c - 1)) / 2 << endl;
  return 0;
}
