#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;
  long long grasspos = 0;
  long long tpos = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'G') {
      grasspos = i;
    }
    if (s[i] == 'T') {
      tpos = i;
    }
  }
  if ((grasspos - tpos) % k != 0) {
    cout << "NO";
    return 0;
  }
  if (grasspos > tpos) {
    swap(grasspos, tpos);
  }
  for (int i = grasspos; i <= tpos; i += k) {
    if (s[i] == '#') {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
