public static void main ( String [ ] args ) {
  Scanner scanner = new Scanner ( System . in ) ;
  String line = scanner . nextLine ( ) ;
  StringTokenizer stringTokenizer = new StringTokenizer ( line ) ;
  int n = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ;
  int k = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ;
  String route = scanner . nextLine ( ) . trim ( ) ;
  int gPos = - 1 , iPos = - 1 ;
  for ( int i = 0 ;
  i < route . length ( ) ;
  i ++ ) {
    if ( route . charAt ( i ) == 'G' ) {
      gPos = i ;
    }
    else if ( route . charAt ( i ) == 'T' ) {
      iPos = i ;
    }
  }
  if ( gPos > iPos ) {
    for ( int i = gPos - k ;
    i >= 0 ;
    i = i - k ) {
      if ( route . charAt ( i ) == 'T' ) {
        System . out . println ( "YES" ) ;
        return ;
      }
      else if ( route . charAt ( i ) == '#' ) {
        System . out . println ( "NO" ) ;
        return ;
      }
    }
    System . out . println ( "NO" ) ;
  }
  else {
    for ( int i = gPos + k ;
    i < n ;
    i = i + k ) {
      if ( route . charAt ( i ) == 'T' ) {
        System . out . println ( "YES" ) ;
        return ;
      }
      else if ( route . charAt ( i ) == '#' ) {
        System . out . println ( "NO" ) ;
        return ;
      }
    }
    System . out . println ( "NO" ) ;
  }
}

public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; StringTokenizer stringTokenizer = new StringTokenizer ( line ) ; int n = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ; int k = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ; String route = scanner . nextLine ( ) . trim ( ) ; int gPos = - 1 , iPos = - 1 ; for ( int i = 0 ; i < route . length ( ) ; i ++ ) { if ( route . charAt ( i ) == ' G ' ) { gPos = i ; } else if ( route . charAt ( i ) == ' T ' ) { iPos = i ; } } if ( gPos > iPos ) { for ( int i = gPos - k ; i >= 0 ; i = i - k ) { if ( route . charAt ( i ) == ' T ' ) { System . out . println ( " YES " ) ; return ; } else if ( route . charAt ( i ) == ' # ' ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " NO " ) ; } else { for ( int i = gPos + k ; i < n ; i = i + k ) { if ( route . charAt ( i ) == ' T ' ) { System . out . println ( " YES " ) ; return ; } else if ( route . charAt ( i ) == ' # ' ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " NO " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))