#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, i, j, k, l, m, n, p, q, r, s = 0, a, b, c, d, ans = 0, x, y;
  cin >> n >> k;
  string s1;
  cin >> s1;
  for (i = 0; i < n; i++) {
    if (s1[i] == 'G') {
      p = i;
    } else if (s1[i] == 'T') {
      q = i;
    }
  }
  if (abs(p - q) % k != 0) {
    cout << "NO\n";
    return 0;
  }
  a = min(p, q);
  b = max(p, q);
  for (i = a; i <= b; i += k) {
    if (s1[i] == '#') {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}
