#include <bits/stdc++.h>
#pragma GCC optimize("O3")
long long x, y, z, a, b, c, d, n, m, mod = 1000000007;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  bool w = true;
  cin >> n >> m >> s;
  a = s.find('G');
  b = s.find('T');
  if (a > b && (a - b) % m == 0) {
    for (int i = a; i > b; i -= m) {
      if (s[i] == '#') {
        w = false;
        break;
      }
    }
  } else if (a < b && (b - a) % m == 0) {
    for (int i = a; i < b; i += m) {
      if (s[i] == '#') {
        w = false;
        break;
      }
    }
  }
  if (w == false || abs(b - a) % m != 0)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
