#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y;
string s;
int main() {
  cin >> n >> m >> s;
  x = s.find('G'), y = s.find('T');
  if (x > y)
    reverse(s.begin(), s.end()), swap(x, y), x = s.find('G'), y = s.find('T');
  bool boo = false;
  for (int i = x; i <= y; i += m) {
    if (s[i] == '#') {
      cout << "NO";
      return 0;
    }
    if (s[i] == 'T') {
      boo = true;
      break;
    }
  }
  if (boo)
    cout << "YES";
  else
    cout << "NO";
}
