#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, k;
  cin >> n >> k >> s;
  int x, y;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == 'G')
      x = i;
    else if (s[i] == 'T')
      y = i;
  }
  int d = x > y ? -1 : 1;
  while (x >= 0 && x < n && x != y && s[x] != '#') {
    x += d * k;
  }
  if (x == y)
    cout << "YES\n";
  else
    puts("NO");
}
