#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000;
int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  int grshop_pos = s.find("G");
  int insect_pos = s.find("T");
  for (int i = grshop_pos; i <= insect_pos; i += k) {
    if (s[i] == '#') {
      cout << "NO";
      cin >> n;
      return 0;
    }
    if (s[i] == 'T') {
      cout << "YES";
      cin >> n;
      return 0;
    }
  }
  for (int i = grshop_pos; i >= insect_pos; i -= k) {
    if (s[i] == '#') {
      cout << "NO";
      cin >> n;
      return 0;
    }
    if (s[i] == 'T') {
      cout << "YES";
      cin >> n;
      return 0;
    }
  }
  cout << "NO";
  cin >> n;
  return 0;
}
