#include <bits/stdc++.h>
using namespace std;
const int pi = 3.14159265;
const int INF = 1 << 30;
const int maxn = 1e5;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int t = s.find("T");
  int g = s.find("G");
  if (g > t) swap(t, g);
  for (int i = g; i < n && i <= t; i += k) {
    if (s[i] == '#') {
      cout << "NO" << endl;
      return 0;
    }
    if (i == t) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}
