If you're on Windows, check out WugFresh's "Nexus Root Toolkit"..(I'm not sure if it can be WINEed or not; I've not tried the tool on Linux directly). There is an easy way to unroot/restore to stock and the toolkit downloads images for just about any build you could wish. There's a thread on Android Development about the toolkit, and there's even a special M build image linked in a post from WugFresh himself that can be used for this kind of thing. This may be the easiest way to go about it.
I use the toolkit now. I was having issues with that build but will try again thanks!