#include <bits/stdc++.h>
using namespace std;
int main() {
  int c1, c2, flag = 0, n, k, grga = 0;
  string s;
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'T') c1 = i;
    if (s[i] == 'G') c2 = i;
  }
  if (c2 > c1) {
    for (int i = c2; i >= c1; i -= k) {
      if (s[i] == '#') flag = 1;
      if (s[i] == 'T') grga = 1;
    }
  } else {
    for (int i = c2; i <= c1; i += k) {
      if (s[i] == '#') flag = 1;
      if (s[i] == 'T') grga = 1;
    }
  }
  if (flag == 1 || grga == 0)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
