public static void main ( String args [ ] ) throws Exception {
  StringTokenizer stok = new StringTokenizer ( new Scanner ( System . in ) . useDelimiter ( "\\A" ) . next ( ) ) ;
  StringBuilder sb = new StringBuilder ( ) ;
  int n = Integer . parseInt ( stok . nextToken ( ) ) ;
  int I = ( Integer . parseInt ( stok . nextToken ( ) ) * 8 ) / n ;
  Integer [ ] a = new Integer [ n ] ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    a [ i ] = Integer . parseInt ( stok . nextToken ( ) ) ;
  }
  Arrays . sort ( a ) ;
  int [ ] b = new int [ n ] ;
  int cnt = 0 ;
  int i = 0 ;
  while ( i < n ) {
    b [ i ] = cnt ;
    while ( ++ i < n && a [ i ] . intValue ( ) == a [ i - 1 ] . intValue ( ) ) b [ i ] = cnt ;
    cnt ++ ;
  }
  cnt = 0 ;
  int v = b [ n - 1 ] ;
  for ( ;
  v > 0 ;
  cnt ++ , v >>= 1 ) ;
  if ( cnt <= I ) System . out . println ( "0" ) ;
  else {
    i = 0 ;
    int min = Integer . MAX_VALUE ;
    while ( i < n ) {
      int lo = i , hi = n ;
      while ( lo != hi ) {
        int md = ( lo + hi ) / 2 ;
        if ( b [ md ] < b [ i ] + ( 1 << I ) ) lo = md + 1 ;
        else hi = md ;
      }
      min = Math . min ( min , i + n - lo ) ;
      while ( ++ i < n && a [ i ] == a [ i - 1 ] ) ;
    }
    System . out . println ( min ) ;
  }
}

public static void main ( String args [ ] ) throws Exception { StringTokenizer stok = new StringTokenizer ( new Scanner ( System . in ) . useDelimiter ( " \\ A " ) . next ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( stok . nextToken ( ) ) ; int I = ( Integer . parseInt ( stok . nextToken ( ) ) * 8 ) / n ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( stok . nextToken ( ) ) ; } Arrays . sort ( a ) ; int [ ] b = new int [ n ] ; int cnt = 0 ; int i = 0 ; while ( i < n ) { b [ i ] = cnt ; while ( ++ i < n && a [ i ] . intValue ( ) == a [ i - 1 ] . intValue ( ) ) b [ i ] = cnt ; cnt ++ ; } cnt = 0 ; int v = b [ n - 1 ] ; for ( ; v > 0 ; cnt ++ , v >>= 1 ) ; if ( cnt <= I ) System . out . println ( "0" ) ; else { i = 0 ; int min = Integer . MAX_VALUE ; while ( i < n ) { int lo = i , hi = n ; while ( lo != hi ) { int md = ( lo + hi ) / 2 ; if ( b [ md ] < b [ i ] + ( 1 << I ) ) lo = md + 1 ; else hi = md ; } min = Math . min ( min , i + n - lo ) ; while ( ++ i < n && a [ i ] == a [ i - 1 ] ) ; } System . out . println ( min ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) (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 (method_invocation object: (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))) name: (identifier) arguments: (argument_list (string_literal))) 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)))) (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: (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) right: (decimal_integer_literal))) right: (identifier)))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) 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: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (update_expression (identifier)) right: (identifier)) right: (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list))))) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (for_statement condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) update: (assignment_expression left: (identifier) right: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (update_expression (identifier)) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (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))))))))