add checking validate of n and k