Why is OCR1B values are not stored?
You have declared the arrays k[] and z[] to have just one element each. Therefore, it is likely that the values you write to k[] are overwriting the values for z[], and the values for z[] are getting clobbered by other variables.