import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Text.Printf import Debug.Trace readInts :: B.ByteString -> [Int] readInts = map (fst . fromJust . B.readInt) . B.words getInts :: IO [Int] getInts = liftM readInts B.getLine solve :: Int -> Int -> Int solve n k = if k > 1 then 2^(n - k) else (2^(n - 1) - n) main = do [n,k] <- getInts print $ solve n k