#include <bits/stdc++.h>
using namespace std;
vector<long long> V, L, Q;
vector<string> P;
map<int, int> M;
set<char> S;
set<char>::iterator it;
long long n, m, a, b, c, d, e, f, cnt, x, y, z, t;
string s, p, ans, temp;
long long arr[1001];
bool xy = 0;
char bd;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  cin >> s;
  for (int i = 0; i < n; i++)
    if (s[i] == 'G' or s[i] == 'T') {
      for (int j = i + m; j < n; j += m) {
        if (s[j] == '#') {
          cout << "NO";
          return 0;
          ;
        }
        if (s[j] == 'G' or s[j] == 'T') {
          cout << "YES";
          return 0;
          ;
        }
      }
    }
  cout << "NO";
}
