now it runs, but second is always null, also the for loops now have the
condition i< (num | k) -1