Don't know why it prints infnite second array.Code is beautiful