def main():
    n,k=map(int,input().split())
    mod=10**9+7

    import numpy as np
    def prepare(n):
        nrt = int(n ** 0.5) + 1
        nsq = nrt * nrt
        facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
        facts[0, 0] = 1
        for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
        for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
        facts = facts.ravel().tolist()
 
        invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
        invs[-1, -1] = pow(facts[-1], mod - 2, mod)
        for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
        for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
        invs = invs.ravel().tolist()
 
        return facts, invs

    facts,invs=prepare(3*n)
    
    def nck(n,k):
        if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

    if k>=n-1:
        print(nck(2*n-1,n-1))
        exit()
    
    else:
        ans=0
        for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
        print(ans)
if __name__=='__main__':
    main() def main():
    n,k=map(int,input().split())
    mod=10**9+7

    import numpy as np
    def prepare(n):
        nrt = int(n ** 0.5) + 1
        nsq = nrt * nrt
        facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
        facts[0, 0] = 1
        for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
        for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
        facts = facts.ravel().tolist()
 
        invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
        invs[-1, -1] = pow(facts[-1], mod - 2, mod)
        for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
        for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
        invs = invs.ravel().tolist()
 
        return facts, invs

    facts,invs=prepare(3*n)
    
    def nck(n,k):
        if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

    if k>=n-1:
        print(nck(2*n-1,n-1))
        exit()
    
    else:
        ans=0
        for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
        print(ans) main n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k mod=10**9+7 mod 10**9+7 10**9 10 9 7 import numpy as np numpy def prepare(n):
        nrt = int(n ** 0.5) + 1
        nsq = nrt * nrt
        facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
        facts[0, 0] = 1
        for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
        for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
        facts = facts.ravel().tolist()
 
        invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
        invs[-1, -1] = pow(facts[-1], mod - 2, mod)
        for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
        for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
        invs = invs.ravel().tolist()
 
        return facts, invs

     prepare nrt = int(n ** 0.5) + 1 nrt int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 nsq = nrt * nrt nsq nrt * nrt nrt nrt facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt) facts np.arange(nsq, dtype=np.int64).reshape(nrt, nrt) np.arange(nsq, dtype=np.int64).reshape np.arange(nsq, dtype=np.int64) np.arange np arange nsq dtype=np.int64 dtype np.int64 np int64 reshape nrt nrt facts[0, 0] = 1 facts[0, 0] facts 0 1 for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
         i range(1, nrt) range 1 nrt facts[:, i] = facts[:, i] * facts[:, i - 1] % mod facts[:, i] facts : facts[:, i] * facts[:, i - 1] % mod facts[:, i] * facts[:, i - 1] facts[:, i] facts : facts[:, i - 1] facts : mod for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
         i range(1, nrt) range 1 nrt facts[i] = facts[i] * facts[i - 1, -1] % mod facts[i] facts i facts[i] * facts[i - 1, -1] % mod facts[i] * facts[i - 1, -1] facts[i] facts i facts[i - 1, -1] facts i - 1 i 1 mod facts = facts.ravel().tolist() facts facts.ravel().tolist() facts.ravel().tolist facts.ravel() facts.ravel facts ravel tolist invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt) invs np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt) np.arange(1, nsq + 1, dtype=np.int64).reshape np.arange(1, nsq + 1, dtype=np.int64) np.arange np arange 1 nsq + 1 nsq 1 dtype=np.int64 dtype np.int64 np int64 reshape nrt nrt invs[-1, -1] = pow(facts[-1], mod - 2, mod) invs[-1, -1] invs -1 pow(facts[-1], mod - 2, mod) pow facts[-1] facts -1 mod - 2 mod 2 mod for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
         i range(nrt - 2, -1, -1) range nrt - 2 nrt 2 -1 -1 invs[:, i] = invs[:, i] * invs[:, i + 1] % mod invs[:, i] invs : invs[:, i] * invs[:, i + 1] % mod invs[:, i] * invs[:, i + 1] invs[:, i] invs : invs[:, i + 1] invs : mod for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
         i range(nrt - 2, -1, -1) range nrt - 2 nrt 2 -1 -1 invs[i] = invs[i] * invs[i + 1, 0] % mod invs[i] invs i invs[i] * invs[i + 1, 0] % mod invs[i] * invs[i + 1, 0] invs[i] invs i invs[i + 1, 0] invs i + 1 i 1 mod invs = invs.ravel().tolist() invs invs.ravel().tolist() invs.ravel().tolist invs.ravel() invs.ravel invs ravel tolist return facts, invs return facts, invs facts invs n n facts,invs=prepare(3*n) facts prepare(3*n) prepare 3*n 3 n invs def nck(n,k):
        if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

     nck if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

     k<0 or k>n k<0 k 0 k>n k n return 0 0 return facts[n]*invs[n-k]*invs[k]%mod facts[n]*invs[n-k]*invs[k]%mod facts[n]*invs[n-k]*invs[k] facts[n]*invs[n-k] facts[n] facts n invs[n-k] invs n-k n k invs[k] invs k mod n n k k if k>=n-1:
        print(nck(2*n-1,n-1))
        exit()
    
    else:
        ans=0
        for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
        print(ans) k>=n-1 k n-1 n 1 print(nck(2*n-1,n-1)) print nck(2*n-1,n-1) nck 2*n-1 2*n 2 n 1 n-1 n 1 exit() exit ans=0 ans 0 for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
         i range(k+1) range k+1 k 1 ans+=nck(n,i)*nck(n-1,i) ans nck(n,i)*nck(n-1,i) nck(n,i) nck n i nck(n-1,i) nck n-1 n 1 i ans%=mod ans mod print(ans) print ans if __name__=='__main__':
    main() __name__=='__main__' __name__ '__main__' main() main def main():
    n,k=map(int,input().split())
    mod=10**9+7

    import numpy as np
    def prepare(n):
        nrt = int(n ** 0.5) + 1
        nsq = nrt * nrt
        facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
        facts[0, 0] = 1
        for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
        for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
        facts = facts.ravel().tolist()
 
        invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
        invs[-1, -1] = pow(facts[-1], mod - 2, mod)
        for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
        for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
        invs = invs.ravel().tolist()
 
        return facts, invs

    facts,invs=prepare(3*n)
    
    def nck(n,k):
        if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

    if k>=n-1:
        print(nck(2*n-1,n-1))
        exit()
    
    else:
        ans=0
        for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
        print(ans) def main():
    n,k=map(int,input().split())
    mod=10**9+7

    import numpy as np
    def prepare(n):
        nrt = int(n ** 0.5) + 1
        nsq = nrt * nrt
        facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
        facts[0, 0] = 1
        for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
        for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
        facts = facts.ravel().tolist()
 
        invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
        invs[-1, -1] = pow(facts[-1], mod - 2, mod)
        for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
        for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
        invs = invs.ravel().tolist()
 
        return facts, invs

    facts,invs=prepare(3*n)
    
    def nck(n,k):
        if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

    if k>=n-1:
        print(nck(2*n-1,n-1))
        exit()
    
    else:
        ans=0
        for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
        print(ans) main
def main():
    n,k=map(int,input().split())
    mod=10**9+7

    import numpy as np
    def prepare(n):
        nrt = int(n ** 0.5) + 1
        nsq = nrt * nrt
        facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
        facts[0, 0] = 1
        for i in range(1, nrt):
            facts[:, i] = facts[:, i] * facts[:, i - 1] % mod
        for i in range(1, nrt):
            facts[i] = facts[i] * facts[i - 1, -1] % mod
        facts = facts.ravel().tolist()
 
        invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
        invs[-1, -1] = pow(facts[-1], mod - 2, mod)
        for i in range(nrt - 2, -1, -1):
            invs[:, i] = invs[:, i] * invs[:, i + 1] % mod
        for i in range(nrt - 2, -1, -1):
            invs[i] = invs[i] * invs[i + 1, 0] % mod
        invs = invs.ravel().tolist()
 
        return facts, invs

    facts,invs=prepare(3*n)
    
    def nck(n,k):
        if k<0 or k>n:
            return 0
        else:
            return facts[n]*invs[n-k]*invs[k]%mod

    if k>=n-1:
        print(nck(2*n-1,n-1))
        exit()
    
    else:
        ans=0
        for i in range(k+1):
            ans+=nck(n,i)*nck(n-1,i)
            ans%=mod
        print(ans)
if __name__=='__main__':
    main()