#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  int k;
  cin >> k;
  string s;
  cin >> s;
  int ig = -1, it = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'G') {
      ig = i;
    }
    if (s[i] == 'T') {
      it = i;
    }
  }
  if (it % k != ig % k) {
    cout << "NO" << endl;
  } else {
    if (ig < it) {
      swap(it, ig);
    }
    for (int i = it; i <= ig; i++) {
      if (s[i] == '#' && (i % k) == (ig % k)) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  }
  return 0;
}
