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