#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, t, g, i;
  bool ok = 1;
  cin >> n >> k;
  string s;
  cin >> s;
  t = s.find('T');
  g = s.find('G');
  if (t > g) {
    for (i = g; i < t; i += k) {
      if (s[i] == '#') {
        ok = 0;
        break;
      }
    }
    if (i > t) ok = 0;
  } else {
    for (i = g; i > t; i -= k) {
      if (s[i] == '#') {
        ok = 0;
        break;
      }
    }
    if (i < t) ok = 0;
  }
  if (ok == 0)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
