#include <bits/stdc++.h>
using namespace std;
int n, k;
int d[1000010][3][2];
int b[1000010], w[1000010];
char s[1000010];
int main() {
  scanf("%d%d\n", &n, &k);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    b[i] = b[i - 1];
    w[i] = w[i - 1];
    if (s[i] == 'W') ++w[i];
    if (s[i] == 'B') ++b[i];
  }
  d[0][0][1] = 1;
  for (int i = 1; i <= n; ++i) {
    if (s[i] != 'W') {
      d[i][0][0] = (d[i - 1][0][0] + d[i - 1][0][1]) % 1000000007;
      if (i >= k) {
        if (w[i] - w[i - k] == 0) {
          d[i][0][0] = (d[i][0][0] + 1000000007 - d[i - k][0][1]) % 1000000007;
        }
      }
      d[i][1][0] = (d[i - 1][1][0] + d[i - 1][1][1]) % 1000000007;
      if (i >= k) {
        if (w[i] - w[i - k] == 0)
          d[i][1][0] = (d[i][1][0] + d[i - k][0][1]) % 1000000007;
      }
      d[i][2][0] = (d[i - 1][2][0] + d[i - 1][2][1]) % 1000000007;
    }
    if (s[i] != 'B') {
      d[i][0][1] = (d[i - 1][0][0] + d[i - 1][0][1]) % 1000000007;
      d[i][1][1] = (d[i - 1][1][0] + d[i - 1][1][1]) % 1000000007;
      if (i >= k) {
        if (b[i] - b[i - k] == 0) {
          d[i][1][1] = (d[i][1][1] + 1000000007 - d[i - k][1][0]) % 1000000007;
        }
      }
      d[i][2][1] = (d[i - 1][2][0] + d[i - 1][2][1]) % 1000000007;
      if (i >= k) {
        if (b[i] - b[i - k] == 0)
          d[i][2][1] = (d[i][2][1] + d[i - k][1][0]) % 1000000007;
      }
    }
  }
  printf("%d\n", (d[n][2][0] + d[n][2][1]) % 1000000007);
  return 0;
}
