#include <bits/stdc++.h>
using namespace std;
const char array_sep[] = " ";
const char array_end[] = "";
const char pair_sep[] = " ";
const char pair_end[] = "\n";
const char map_sep[] = "->";
const char map_end[] = "\n";
const int dx[] = {0, 1};
const int dy[] = {1, 0};
const int ddx[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};
template <typename A>
ostream& operator<<(ostream& os, const vector<A>& x) {
  for (int i = 0; i < x.size(); i++) os << x[i] << array_sep;
  os << array_end;
  return os;
}
template <typename A>
ostream& operator<<(ostream& os, const set<A>& x) {
  for (auto& y : x) os << y << " ";
  return os;
}
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
  os << x.first << pair_sep << x.second << pair_end;
  return os;
}
template <typename A>
istream& operator>>(istream& is, vector<A>& x) {
  for (int i = 0; i < x.size(); i++) is >> x[i];
  return is;
}
template <typename A, typename B>
istream& operator>>(istream& is, pair<A, B>& x) {
  is >> x.first >> x.second;
  return is;
}
template <typename _key, typename _val>
ostream& operator<<(ostream& os, map<_key, _val>& mp) {
  os << "{\n";
  for (auto it : mp) os << "\t" << it.first << map_sep << it.second << map_end;
  os << "}\n";
  return os;
}
template <typename _response>
void die(_response ans) {
  cout << ans << endl;
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  int k;
  string s;
  cin >> n >> k;
  cin >> s;
  int s1, s2;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'T') s1 = i;
    if (s[i] == 'G') s2 = i;
  }
  if (s1 > s2) swap(s1, s2);
  vector<bool> pos(n, false);
  queue<int> q;
  pos[s1] = true;
  q.push(s1);
  while (!q.empty() && !pos[s2]) {
    int v = q.front();
    q.pop();
    if (v + k < n && s[v + k] != '#' && !pos[v + k]) {
      pos[v + k] = true;
      q.push(v + k);
    }
    if (v - k >= 0 && s[v - k] != '#' && !pos[v - k]) {
      pos[v - k] = true;
      q.push(v - k);
    }
  }
  (pos[s2]) ? die("YES") : die("NO");
  return 0;
}
