#include <bits/stdc++.h>
const int maxn = 1000100;
const int mo = 1000000007;
char s[maxn + 1];
int f[maxn + 1][3][2], sum[maxn + 1][3][2];
int last[maxn + 1][2];
int n, K;
void init() {
  int i;
  scanf("%d%d", &n, &K);
  scanf("%s", s);
  for (i = n; i >= 1; --i)
    if (s[i - 1] == 'W')
      s[i] = 1;
    else if (s[i - 1] == 'B')
      s[i] = 0;
    else
      s[i] = 2;
}
inline void momo(int &x) {
  if (x < 0) x += mo;
  if (x >= mo) x -= mo;
}
void calc_last() {
  int i, j;
  last[0][0] = last[0][1] = 0;
  for (i = 1; i <= n; ++i)
    for (j = 0; j < 2; ++j)
      if (s[i] == j)
        last[i][j] = i;
      else
        last[i][j] = last[i - 1][j];
}
void calc_f() {
  int i, j, c, oldj, start, stop;
  for (i = 0; i < 3; ++i)
    for (j = 0; j < 2; ++j) sum[0][i][j] = f[0][i][j] = 0;
  f[0][0][0] = f[0][0][1] = 1;
  sum[0][0][0] = sum[0][0][1] = 1;
  for (i = 1; i <= n; ++i)
    for (j = 0; j < 3; ++j)
      for (c = 0; c < 2; ++c) {
        if (j == 0) {
          if (c == 1) {
            start = 0;
            stop = i - 1;
            oldj = 0;
          } else {
            start = i - K + 1;
            stop = i - 1;
            oldj = 0;
          }
        } else if (j == 1) {
          if (c == 1) {
            start = i - K + 1;
            stop = i - 1;
            oldj = 1;
          } else {
            start = 0;
            stop = i - 1;
            oldj = 1;
          }
        } else {
          if (c == 1) {
            start = 0;
            stop = i - 1;
            oldj = 2;
          } else {
            start = 0;
            stop = i - 1;
            oldj = 2;
          }
        }
        if (start < 0) start = 0;
        if ((start <= stop) && (last[i][1 - c] <= stop)) {
          if (last[i][1 - c] > start) start = last[i][1 - c];
          f[i][j][c] = sum[stop][oldj][1 - c];
          if (start - 1 >= 0) {
            f[i][j][c] -= sum[start - 1][oldj][1 - c];
            momo(f[i][j][c]);
          }
        }
        if (((j == 1) && (c == 0)) || ((j == 2) && (c == 1))) {
          if ((j == 1) && (c == 0)) {
            start = 0;
            stop = i - K;
            oldj = 0;
          } else {
            start = 0;
            stop = i - K;
            oldj = 1;
          }
          if (start < 0) start = 0;
          if ((start <= stop) && (last[i][1 - c] <= stop)) {
            if (last[i][1 - c] > start) start = last[i][1 - c];
            f[i][j][c] = f[i][j][c] + sum[stop][oldj][1 - c];
            momo(f[i][j][c]);
            if (start - 1 >= 0) {
              f[i][j][c] -= sum[start - 1][oldj][1 - c];
              momo(f[i][j][c]);
            }
          }
        }
        sum[i][j][c] = sum[i - 1][j][c] + f[i][j][c];
        momo(sum[i][j][c]);
      }
}
void work() {
  calc_last();
  calc_f();
}
void output() {
  int result;
  result = f[n][2][1] + f[n][2][0];
  momo(result);
  printf("%d\n", result);
}
int main() {
  init();
  work();
  output();
  return 0;
}
