#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

static const LL MODVAL = 1000000009;

class BunnySequence { public:
	int getNumber(int m, int n) 
	{
		vector<LL> tbl(n+1);
		vector<LL> tbl_sum(n+1);
		tbl[0] = 1;
		tbl_sum[0] = 1;
		for(int i=1; i<=n; ++i) {
			tbl[i] = (tbl_sum[i-1] - (i-m-1>=0 ? tbl_sum[i-m-1] : 0) + MODVAL) % MODVAL;
			tbl_sum[i] = (tbl_sum[i-1] + tbl[i]) % MODVAL;
		}
		return (tbl[n] - (n>=m ? tbl[n-m] : 0) + MODVAL) % MODVAL;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, BunnySequence().getNumber(m, n));}
int main(){

CASE(0)
	int m = 5; 
	int n = 3; 
	int _ = 4; 
END
CASE(1)
	int m = 487; 
	int n = 0; 
	int _ = 1; 
END
CASE(2)
	int m = 19; 
	int n = 10; 
	int _ = 512; 
END
CASE(3)
	int m = 3; 
	int n = 4; 
	int _ = 6; 
END
CASE(4)
	int m = 10; 
	int n = 487; 
	int _ = 829515032; 
END
/*
CASE(5)
	int m = ; 
	int n = ; 
	int _ = ; 
END
CASE(6)
	int m = ; 
	int n = ; 
	int _ = ; 
END
*/
}
// END CUT HERE
