#include <stdio.h>

int kaizyo(int n)
{
    int result=0;
    if(n==1)
        return 1;
    else{
        result=n*kaizyo(n-1);
        return result;
    }
}

int main()
{
    int n,k;
    int result=0;

    do{
        scanf("%d%d",&n,&k);
    }while(n<1||n>200000||k<1||k>n+1);

    for(int i=k;i<n+1;i++){
        result+=kaizyo(n+1)/(kaizyo(i)*kaizyo(n+1-i));
    }

    printf("%d",result%(1000000000+7));

    return 0;
}