#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
void solve() {
  long long int n, k;
  string str;
  cin >> n >> k >> str;
  long long int pos = str.find('G');
  long long int target = str.find('T');
  if (pos < target) {
    for (long long int i = pos + k; i < str.size(); i += k) {
      if (str[i] == 'T') {
        cout << "YES";
        return;
      } else if (str[i] == '#') {
        cout << "NO";
        return;
      }
    }
  } else {
    for (long long int i = pos - k; i >= 0; i -= k) {
      if (str[i] == 'T') {
        cout << "YES";
        return;
      } else if (str[i] == '#') {
        cout << "NO";
        return;
      }
    }
  }
  cout << "NO";
}
signed main() {
  long long int test_Case = 1;
  while (test_Case--) {
    solve();
  }
  return 0;
}
