#include <bits/stdc++.h>
using namespace std;
char v[1001];
int main() {
  int n, k, locatieA = 0, locatieB = 0, ok = 0;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    if (v[i] == 'G') locatieA = i;
    if (v[i] == 'T') locatieB = i;
  }
  if (locatieB < locatieA) {
    k = k * (-1);
    for (int i = locatieA; i >= locatieB; i = i + k) {
      if (v[i] == '#') {
        cout << "NO";
        return 0;
      }
      if (v[i] == 'T') ok = 1;
    }
    if (ok == 1)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  for (int i = locatieA; i <= locatieB; i = i + k) {
    if (v[i] == '#') {
      cout << "NO";
      return 0;
    }
    if (v[i] == 'T') ok = 1;
  }
  if (ok == 1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
