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