#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  int pg, pt;
  for (int i = 0; i < n; i++) {
    if (str[i] == 'G') pg = i;
    if (str[i] == 'T') pt = i;
  }
  if (abs(pg - pt) % k == 0) {
    int s = pg;
    while (s != pt && str[s] != '#') {
      s < pt ? s += k : s -= k;
    }
    if (str[s] == 'T') {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  } else {
    printf("NO\n");
  }
  return 0;
}
