#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, g, t, county = 0;
  cin >> x >> y;
  vector<char> v(x);
  bool f = false;
  for (int i = 0; i < x; i++) {
    cin >> v[i];
    if (v[i] == 'G')
      g = i;
    else if (v[i] == 'T')
      t = i;
  }
  int dis = abs(g - t);
  if (dis % y == 0) {
    if (g < t) {
      for (int i = g; i <= t; i += y)
        if (v[i] == '#') {
          cout << "NO";
          f = true;
          county++;
          break;
        }
    } else {
      for (int i = t; i <= g; i += y)
        if (v[i] == '#') {
          cout << "NO";
          f = true;
          county++;
          break;
        }
    }
    if (!f) {
      cout << "YES";
      county++;
    }
  }
  if (county == 0) cout << "NO";
  return 0;
}
