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