#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, Tposition, Gposition;
  vector<int> vec;
  cin >> n >> k;
  char c[n];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    if (c[i] == 'T') Tposition = i;
    if (c[i] == 'G') Gposition = i;
    if (c[i] == '#') vec.push_back(i);
  }
  if (abs(Tposition - Gposition) % k != 0) return cout << "NO" << endl, 0;
  for (vector<int>::iterator itr = vec.begin(); itr != vec.end(); itr++) {
    if (*itr > min(Tposition, Gposition) && *itr < max(Gposition, Tposition) &&
        abs(*itr - Gposition) % k == 0)
      return cout << "NO" << endl, 0;
  }
  cout << "YES" << endl;
}
