#include <bits/stdc++.h>
using namespace std;
string s;
int g, t, n;
int main() {
  cin >> n >> n;
  cin >> s;
  int l = s.size();
  for (int i = 0; i < l; i++) {
    if (s[i] == 'T')
      t = i;
    else if (s[i] == 'G')
      g = i;
  }
  if (g < t) swap(g, t);
  int i;
  if ((g - t) % n != 0) {
    cout << "NO";
    return 0;
  }
  for (i = t; i <= g; i += n) {
    if (s[i] == '#') {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
