#include <bits/stdc++.h>
using namespace std;
int n, k;
string input;
int g, t;
int main(void) {
  cin >> n >> k >> input;
  for (int i = 0; i < n; i++) {
    if (input[i] == 'G') g = i;
    if (input[i] == 'T') t = i;
  }
  if ((g - t) % k != 0) {
    cout << "NO" << endl;
    return 0;
  }
  if (g > t) swap(g, t);
  for (int i = g + k; i < t; i += k)
    if (input[i] == '#') {
      cout << "NO" << endl;
      return 0;
    }
  cout << "YES" << endl;
  return 0;
}
