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