#include using namespace std; #define ll long long #define rep(i,n) for(int i=0;i struct modint{ uint64_t val; constexpr modint(const int64_t val_=0) noexcept:val((val_%int64_t(mod)+int64_t(mod))%int64_t(mod)){} constexpr modint operator-() const noexcept{ return modint(*this)=mod-val; } constexpr modint operator+(const modint rhs) const noexcept{ return modint(*this)+=rhs; } constexpr modint operator-(const modint rhs) const noexcept{ return modint(*this)-=rhs; } constexpr modint operator*(const modint rhs) const noexcept{ return modint(*this)*=rhs; } constexpr modint operator/(const modint rhs) const noexcept{ return modint(*this)/=rhs; } constexpr modint &operator+=(const modint rhs) noexcept{ val+=rhs.val; val-=((val>=mod)?mod:0); return (*this); } constexpr modint &operator-=(const modint rhs) noexcept{ val+=((val>=1; } return (*this)*=now; } modint & operator++(){ val++; if (val == mod) val = 0; return *this; } modint operator++(int){ modint res = *this; ++*this; return res; } constexpr bool operator==(const modint rhs) noexcept{ return val==rhs.val; } constexpr bool operator!=(const modint rhs) noexcept{ return val!=rhs.val; } friend constexpr ostream &operator<<(ostream& os,const modint x) noexcept{ return os<<(x.val); } friend constexpr istream &operator>>(istream& is,modint& x) noexcept{ uint64_t t; is>>t,x=t; return is; } }; typedef modint mint; mint modinv(long long a, long long m = mod) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; return mint(u); } //Combination vector fact; vector invf; ll comb(ll n,ll k){ if(n<0||k<0||k>n) return 0LL; else{ ll a = fact[n]*invf[k]%mod; a = a*invf[n-k]%mod; return a; } } int main() { riano_; mint ans = 0; ll N,K; cin >> N >> K; fact.assign(N+1,1LL); invf.assign(N+1,1LL); rep(i,N) fact[i+1] = fact[i]*(i+1)%mod; rep(i,N+1) invf[i] = modinv(fact[i],mod).val; if(K==0){ cout << 1 << endl; return 0; } if(K==1){ if(N%2==0){ cout << 2 << endl; } else{ cout << N-2 << endl; } return 0; } ll M = ((N-K)/2)*2; for(int i=0;i<=M;i+=2){ ans += mint(i+1)*mint(comb(N-2-i,K-2)); } cout << ans << endl; }