#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, K, T;
  cin >> n >> k;
  string str;
  cin >> str;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == 'G') {
      K = i + 1;
    }
    if (str[i] == 'T') {
      T = i + 1;
    }
  }
  int size = abs(T - K), z;
  if (T - K > 0)
    z = 1;
  else {
    z = -1;
  }
  if (size % k != 0) {
    cout << "NO";
  } else {
    for (int i = K - 1; i != T - 1; i += k * z) {
      if (str[i] == '#') {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
  }
}
