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