#include <stdio.h>
#define MOD 1000000007
typedef long long ll;
ll comb(int n, int r) {
	ll ans = 1;
	for (int i = n; i > n - r; i--) {
		ans *= i;
	}
	for (int i = 1; i <= r; i++) {
		ans /= i;
	}
	return ans;
}
int main() {
	int n, k;
	ll sum = 0;
	scanf("%d%d", &n, &k);
	for (int i = k; i <= n; i++) {
		sum += comb(n + 1, i);
		sum %= MOD;
	}
	printf("%lld\n", sum);
	return 0;
}