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