#include <bits/stdc++.h>
using namespace std;
const int N = 123456;
string s;
int g, t, n, k;
int main() {
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'T') t = i;
    if (s[i] == 'G') g = i;
  }
  int a = min(t, g);
  int b = max(t, g);
  for (int i = a; i < b; i += k) {
    if (s[i] == '#') {
      cout << "NO" << endl;
      return 0;
    }
  }
  if ((b - a) % k == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
