#include <bits/stdc++.h>
using namespace std;
string a;
int main() {
  int n, k;
  cin >> n >> k;
  cin >> a;
  int st = 0, tar = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 'G')
      st = i;
    else if (a[i] == 'T')
      tar = i;
  }
  if ((max(st, tar) - min(st, tar)) % k) {
    puts("NO");
    return 0;
  }
  for (int i = min(st, tar); i <= max(tar, st); i += k) {
    if (a[i] == '#') {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}
