#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
vector<int> adj[maxn];
int n, k, tt, gg;
string s;
void tg() {
  for (int i = 0; i < n; i++)
    if (s[i] == 'T')
      tt = i;
    else if (s[i] == 'G')
      gg = i;
}
bool conect() {
  int i = tt;
  while (i >= 0 && i < n) {
    if (s[i] == 'G') return true;
    if (s[i] == '#') return false;
    i += k;
  }
  return false;
}
int main() {
  cin >> n >> k >> s;
  tg();
  if (tt > gg) k = -k;
  if (conect())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
