def main():
    
    for i in range(N+1):
        s = 0
        list_i = list(str(i))
        for j in range(1,10):
            s += list_i.count(str(j))
        if s == K:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()