#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  int g, t;
  g = s.find('G');
  t = s.find('T');
  if (t < g) {
    s = string(s.rbegin(), s.rend());
    g = s.find('G');
    t = s.find('T');
  }
  while (g + k < n) {
    g += k;
    if (s[g] == 'T') {
      cout << "YES";
      return 0;
    }
    if (s[g] == '#') {
      cout << "NO";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
