If no arrangement is possible then our answer will remain INT_MAX so return - 1
if ( dp [ K - 1 ] [ n - 1 ] == sys . maxsize ) : NEW_LINE INDENT return - 1 NEW_LINE DEDENT else : NEW_LINE INDENT return dp [ K - 1 ] [ n - 1 ] NEW_LINE DEDENT