#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<char> poles(n);
  for (long long i = 0; i < n; i++) {
    cin >> poles[i];
  }
  long long type = 0;
  bool flag = false;
  for (long long i = k; i < n; i++) {
    if (poles[i - k] == 'G' || poles[i - k] == 'T') {
      if (poles[i] == '.')
        poles[i] = poles[i - k];
      else if (poles[i] != poles[i - k] && poles[i] != '#') {
        flag = true;
      }
    }
  }
  if (flag)
    cout << "YES";
  else
    cout << "NO";
  cin >> n;
  return 0;
}
