Weak ferromagnetism and spin-glass state with nanosized nickel carbide