#include <bits/stdc++.h>
using namespace std;
int const N = 3e3 + 100;
int n, k, t, g;
string second;
int main() {
  cin >> n >> k >> second;
  for (int i = 0; i < n; ++i) {
    if (second[i] == 'G') {
      g = i + 1;
    } else if (second[i] == 'T') {
      t = i + 1;
    }
  }
  if (abs(g - t) % k == 0) {
    if (g > t) {
      for (int i = t - 1; i < g; i += k) {
        if (second[i] == '#') {
          cout << "NO";
          return 0;
        }
      }
    } else {
      for (int i = g - 1; i < t; i += k) {
        if (second[i] == '#') {
          cout << "NO";
          return 0;
        }
      }
    }
    cout << "YES";
  } else
    cout << "NO";
}
