#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  long long x = -1, y;
  for (long long i = (0); i < (n); i++) {
    if (s[i] == 'T' || s[i] == 'G') {
      if (x == -1)
        x = i;
      else
        y = i;
    }
  }
  if ((y - x) % k != 0) {
    cout << "NO"
         << "\n";
    return 0;
  }
  bool flag = 1;
  while (x < y) {
    if (s[x] == '#') {
      cout << "NO"
           << "\n";
      return 0;
    }
    x = x + k;
  }
  cout << "YES"
       << "\n";
  return 0;
}
