Insomnia sufferers to be given app on the NHS instead of sleeping pills