public static void main ( String ... orange ) throws Exception {
  Scanner input = new Scanner ( System . in ) ;
  int numCases = input . nextInt ( ) ;
  for ( int n = 0 ;
  n < numCases ;
  n ++ ) {
    int N = input . nextInt ( ) ;
    int K = input . nextInt ( ) ;
    int [ ] sums = new int [ N - K + 1 ] ;
    for ( int i = 0 ;
    i < N - K + 1 ;
    i ++ ) sums [ i ] = input . nextInt ( ) ;
    int [ ] maxdiffs = new int [ K ] ;
    int [ ] mindiffs = new int [ K ] ;
    int [ ] currdiff = new int [ K ] ;
    for ( int i = K ;
    i < N ;
    i ++ ) {
      currdiff [ i % K ] += sums [ i - K + 1 ] - sums [ i - K ] ;
      if ( currdiff [ i % K ] > maxdiffs [ i % K ] ) maxdiffs [ i % K ] = currdiff [ i % K ] ;
      if ( currdiff [ i % K ] < mindiffs [ i % K ] ) mindiffs [ i % K ] = currdiff [ i % K ] ;
    }
    int [ ] diffdiffs = new int [ K ] ;
    for ( int i = 0 ;
    i < K ;
    i ++ ) diffdiffs [ i ] = maxdiffs [ i ] - mindiffs [ i ] ;
    int maxdiffdiff = 0 ;
    for ( int i = 0 ;
    i < K ;
    i ++ ) if ( diffdiffs [ i ] > maxdiffdiff ) maxdiffdiff = diffdiffs [ i ] ;
    int highBound = 0 ;
    for ( int i = 0 ;
    i < K ;
    i ++ ) highBound += maxdiffdiff - diffdiffs [ i ] ;
    int target = sums [ 0 ] ;
    for ( int i = 0 ;
    i < K ;
    i ++ ) target += mindiffs [ i ] ;
    target = ( target % K + K ) % K ;
    int ans = maxdiffdiff + ( target <= highBound ? 0 : 1 ) ;
    System . out . printf ( "Case #%d: " , n + 1 ) ;
    System . out . println ( ans ) ;
  }
}

public static void main ( String ... orange ) throws Exception { Scanner input = new Scanner ( System . in ) ; int numCases = input . nextInt ( ) ; for ( int n = 0 ; n < numCases ; n ++ ) { int N = input . nextInt ( ) ; int K = input . nextInt ( ) ; int [ ] sums = new int [ N - K + 1 ] ; for ( int i = 0 ; i < N - K + 1 ; i ++ ) sums [ i ] = input . nextInt ( ) ; int [ ] maxdiffs = new int [ K ] ; int [ ] mindiffs = new int [ K ] ; int [ ] currdiff = new int [ K ] ; for ( int i = K ; i < N ; i ++ ) { currdiff [ i % K ] += sums [ i - K + 1 ] - sums [ i - K ] ; if ( currdiff [ i % K ] > maxdiffs [ i % K ] ) maxdiffs [ i % K ] = currdiff [ i % K ] ; if ( currdiff [ i % K ] < mindiffs [ i % K ] ) mindiffs [ i % K ] = currdiff [ i % K ] ; } int [ ] diffdiffs = new int [ K ] ; for ( int i = 0 ; i < K ; i ++ ) diffdiffs [ i ] = maxdiffs [ i ] - mindiffs [ i ] ; int maxdiffdiff = 0 ; for ( int i = 0 ; i < K ; i ++ ) if ( diffdiffs [ i ] > maxdiffdiff ) maxdiffdiff = diffdiffs [ i ] ; int highBound = 0 ; for ( int i = 0 ; i < K ; i ++ ) highBound += maxdiffdiff - diffdiffs [ i ] ; int target = sums [ 0 ] ; for ( int i = 0 ; i < K ; i ++ ) target += mindiffs [ i ] ; target = ( target % K + K ) % K ; int ans = maxdiffdiff + ( target <= highBound ? 0 : 1 ) ; System . out . printf ( " Case ▁ # % d : ▁ " , n + 1 ) ; System . out . println ( ans ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (spread_parameter (type_identifier) (variable_declarator name: (identifier)))) (throws (type_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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (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: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (identifier)) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (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: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))