#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, st, end;
  string inp;
  vector<int> hash_pos;
  vector<int> steps;
  cin >> n >> k;
  cin >> inp;
  for (int i = 0; i < n; i++) {
    if (inp[i] == 'G')
      st = i;
    else if (inp[i] == 'T')
      end = i;
    else if (inp[i] == '#')
      hash_pos.push_back(i);
  }
  if (end > st)
    for (int i = st; i <= end; i += k) steps.push_back(i);
  else
    for (int i = end; i <= st; i += k) steps.push_back(i);
  for (int i = 0; i < steps.size(); i++)
    for (int j = 0; j < hash_pos.size(); j++)
      if (hash_pos[j] == steps[i]) {
        cout << "NO";
        return 0;
      }
  if (abs(st - end) % k == 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
