#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ig, it;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'G') {
      ig = i;
    }
    if (s[i] == 'T') {
      it = i;
    }
  }
  if ((ig - it) % k != 0) {
    cout << "NO";
    return 0;
  }
  for (int i = min(ig, it); i <= max(ig, it); i += k) {
    if (s[i] == '#') {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
