#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
string s;
int n, k;
bool flag = 0;
int main() {
  cin >> n >> k >> s;
  int i = s.find('G');
  for (int j = i; j < n; j += k) {
    if (s[j] == 'T') flag = 1;
    if (s[j] == '#') break;
  }
  for (int j = i; j >= 0; j -= k) {
    if (s[j] == 'T') flag = 1;
    if (s[j] == '#') break;
  }
  cout << (flag ? "YES" : "NO");
}
