{-# OPTIONS_GHC -O2 #-}
import Control.Applicative
import Data.List
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BS
import Data.Maybe (fromJust)
import qualified Data.Map as M

dp m (n,k)
    | k == 0 || k == n = (m, 1)
    | otherwise        = f $ M.lookup (n,k) m where
        f :: Maybe Int -> (M.Map (Int,Int) Int , Int)
        f (Just x) = (m, x)
        f Nothing  = (M.insert (n,k) (x1 + x2) m2, x1 + x2)
            where (m1, x1) = dp m  (n-1, k)
                  (m2, x2) = dp m1 (n-1, k-1)

f :: [Int] -> [String]
f [n,k] = snd $ foldr g (M.empty, []) [1..k] where
    g i (m,x) = (m2, (show $ v1*v2 `mod` (10^9 + 7)):x)
        where (m1,v1) = dp m  (n-k+1,i)
              (m2,v2) = dp m1 (k-1, i-1)

main = interact $ unlines.f.map read.words

-- main = BC.getContents >>= putStrLn . f . map ((\[x,y] -> (x,y)) . map (fst . fromJust . BC.readInt) . BC.words) . tail . BC.lines

{-A ????
f :: [Char] -> String
f (a:b:c:d:_)
    | a == b && c == d && b /= c = "Yes"
    | otherwise = "No"

main :: IO()
main = interact $ f . sort
-}

{-B
f :: [Int] -> Int
f xs = length $ filter (== True) $ zipWith (==) (zipf xs) (zipf $ tail xs)
    where zipf xs = zipWith (<) xs (tail xs)

main :: IO()
main = interact $ show.f.map read.words.last.lines
-}

{-C
f :: [Int] -> Int
f xs = xs !! m - xs !! (m-1)
    where m = (lenght xs) `div` 2
    
main :: IO()
main = interact $ show.f.sort.map read.words.last.lines
-}

{-D TLE
strip    xs = foldr (\x ys -> if x `elem` ys then ys else x:ys) [last xs] xs
stripSeq xs = foldr (\x ya@(y:_) -> if x == y then ya else (x:ya)) [last xs] xs
stripSeq    = map head.group
strip       = stripSeq.sort
strip = nub

count ns xs = foldr (\n acc -> length (filter (== n) xs) : acc) [] ns

f :: [Int] -> [Int]
f (n:k:_) = count [1..k].map (sum.stripSeq) .strip.permutations $ replicate k 1 ++ replicate (n-k) 0

main :: IO()
main = interact $ unlines.map show.f.map read.words
-}
