Taking longer to reach the rapid eye movement (REM) stage of sleep could mean you are more likely to develop dementia.