#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int len = s.length();
  int g, t;
  ;
  for (int i = 0; i <= len - 1; i++) {
    if (s[i] == 'G') g = i;
    if (s[i] == 'T') t = i;
  }
  if (g > t) swap(g, t);
  if ((t - g) % k) return puts("NO"), 0;
  for (int i = g; i <= t; i += k)
    if (s[i] == '#') return puts("NO"), 0;
  puts("YES");
  return 0;
}
