#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7, oo = 1e9 + 7;
int n, k, a;
char c;
string s;
bool can;
int main() {
  cin >> n >> k >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'G' || s[i] == 'T') {
      c = s[i] == 'G' ? 'T' : 'G';
      a = i;
      break;
    }
  }
  for (int i = a; i < n; i += k) {
    if (s[i] == c) can = true;
    if (s[i] == '#') break;
  }
  if (can)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
