#include <bits/stdc++.h>
int n, k;
char ch[1000010];
long long int dy[1000010], dy1[1000010], dy2[1000010];
long long int answer;
int main(void) {
  int conti, i;
  scanf("%d %d", &n, &k);
  scanf("%s", &ch[1]);
  conti = 0;
  dy[0] = 1;
  for (i = 0; i < n; i++) {
    if (ch[i + 1] == 'X' || ch[i + 1] == 'B')
      conti++;
    else
      conti = 0;
    dy[i + 1] = dy[i];
    dy[i + 1] %= 1000000007;
    if (ch[i + 1] == 'X') {
      dy[i + 1] += dy[i];
      dy[i + 1] %= 1000000007;
    }
    if (conti < k) continue;
    if (i + 1 == k) {
      dy[i + 1] -= dy[0];
      if (dy[i + 1] < 0) dy[i + 1] += 1000000007;
      dy1[i + 1] = dy[0];
    } else if (ch[(i + 1) - k] == 'W' || ch[(i + 1) - k] == 'X') {
      dy[i + 1] -= dy[i - k];
      if (dy[i + 1] < 0) dy[i + 1] += 1000000007;
      dy1[i + 1] = dy[i - k];
    }
  }
  conti = 0;
  dy[n + 1] = 1;
  for (i = n; i >= 1; i--) {
    if (ch[i] == 'X' || ch[i] == 'W')
      conti++;
    else
      conti = 0;
    dy[i] = dy[i + 1];
    dy[i] %= 1000000007;
    if (ch[i] == 'X') {
      dy[i] += dy[i + 1];
      dy[i] %= 1000000007;
    }
    dy2[i] = dy2[i + 1];
    dy2[i] %= 1000000007;
    if (ch[i] == 'X') {
      dy2[i] += dy2[i + 1];
      dy2[i] %= 1000000007;
    }
    if (conti < k) continue;
    if (i == n - k + 1) {
      dy[i] -= dy[i + k];
      if (dy[i] < 0) dy[i] += 1000000007;
      dy2[i] += dy[n + 1];
    } else if (ch[i + k] == 'X' || ch[i + k] == 'B') {
      dy[i] -= dy[i + k + 1];
      if (dy[i] < 0) dy[i] += 1000000007;
      dy2[i] += dy[i + k + 1];
    }
  }
  for (i = 0; i <= n; i++) {
    answer += ((long long int)dy1[i] * dy2[i + 1]);
    answer %= 1000000007;
  }
  printf("%I64d\n", answer);
  return false;
}
