#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, g, t;
  string s, ans = "NO";
  cin >> n >> k >> s;
  g = s.find("G");
  t = s.find("T");
  if (t > g) {
    while (g + k < n) {
      g += k;
      if (s[g] == '#')
        break;
      else if (g == t) {
        ans = "YES";
        break;
      }
    }
  } else {
    while (g - k >= 0) {
      g -= k;
      if (s[g] == '#')
        break;
      else if (g == t) {
        ans = "YES";
        break;
      }
    }
  }
  cout << ans;
  return 0;
}
