Install your window manager first (e.g. sudo apt-get install waimea). When the installation finishes, log out the system ("log out" or "end current session"). When the x server restarts and you are prompted for a password, select your newly installed window manager from the "system" menu.
In Ubuntu, Gnome is installed by default; in Kubuntu KDE, in Xubuntu XFCE and in Fluxbuntu Fluxbox.