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