How many numbers are there with sum of digit is equal to $ k $? Define $D(n)$ is sum of digits of $n$
Example $D(357)=3+5+7=15$
Let $x\in \mathbb{N}$ define function $f$ as
$$\begin{split} f_k(x) &= \#\{a < x \;\colon D(a)=k\} \\ \\&= \sum_{D(a)=k\\ \; a < x}1\end{split}$$
Example  let $x=100$ and $k=2$ then $f_2(100)=|\{2,11,20\}|=3$
Clearly $f_1(10^y)=y$
Theorem 1: let $y\in \mathbb{N}$ and $1\le k\le 9$ then
$$f_k(10^y)=\binom{k+y-1}k$$
Proof : Every integer $a$ such that $D(a)= k$ can be constructed by arranging a string with $k$ dots and $y-1$ lines, treating the lines as digit separators, and letting each digit equal the number of dots. For example, the number $3105=a$ has $D(3105)=9$, and it is represented by the string:

...|.||.....

The number of such strings is exactly $\binom{9+y-1}9$. Here $y=4$ and get $f_9(10^4)=\binom{9+3}9$ similarly it follows for every $1\le k\le 9$. $\quad \square$

Problem 1: what is the formula to calculate $f_{10}(10^y)$ ?
Problem 2: what is the general formula to calculate $f_k(10^y)$ for every $k$?

Edit: From observational work I construct following formula for $1\le k\le 19$ (using Newton's interpolation method)
$$f_k(10^y)= \binom{k+y-1}{k}-\sum_{i=1}^{k-9}i\binom{y}i \binom{k-10}{i-1}$$
Can someone please help to prove it
Source code
t=1
# Take input from user
y = int(input("y : "))
k = int(input("k : "))

n1=10
t_array = []
while t < 10**y:
    n2=t
    rem_array = []
    while n2 != 0:
        mod = n2%n1
        if mod != 0:
          rem = mod
          n2 = n2 - rem
          rem_array.append(round(rem))
          n2=n2/n1
        else:
            n2 = n2/n1
            rem_array.append(0)
#   print(rem_array[::-1])
    
    if round(sum(rem_array))==k:
        t_array.append(t)
        print("\n ",len(t_array),'f(',t,')','=',k)

    t = t+1


Reference and related post: Proof for theorem 1 link
 A: If $n$ is an integer with $D(n)=k$ then the nonzero digits of $n$ form a partition of $k$ into parts of size at most $9$. Conversely, concatenating the numbers in a partition of $k$ into parts of at most $9$ yields an integer with $D(n)=k$. Permuting the digits and interspresing them with $0$'s then yields all integers with digit sum $k$.
Denote the set of all partitions of $k$ into parts of size at most $9$ by $P_9(k)$. For a partition $p\in P_9(k)$ denote its number of parts by $N(p)$, and the number of distinct permutations of the partition by $S(p)$. For example, for the partition $p\in P_9(10)$ given by
$$10=3+2+2+1+1+1,$$
we have $N(p)=6$ and $S(p)=\frac{6!}{1!2!3!}=60$. Then it follows that
$$f_k(10^y)=\sum_{p\in P_9(k)}\binom{y}{N(p)}S(p).$$
Given a not too large natural number $k$, we can fairly quickly compute all partitions in $P_9(k)$, and then compute $N(p)$ and $S(p)$ for every $p\in P_9(k)$. Then it is a simple matter of evaluating the above polynomial in $y$ (of degree $k$) for every desired value of $y$. However, as far as I know there are no practical closed forms for any of these numbers pertaining to partitions. So problem 2 seems out of reach.
As for problem 1; there are $41$ partitions of $10$ into parts of size at most $9$. For each of these it is a routine matter to compute $N(p)$ and $S(p)$ and hence to find the following closed form:
$$f_{10}(10^y)=\sum_{k=1}^9\binom{9}{k}\binom{y}{k+1}.$$
This seems to suggest that perhaps problem 2 is not out of reach.
A: Call $A_k(y)=\{(x_1,\cdots ,x_y):x_1+\cdots +x_y=k\}.$ This is the the same as the problem of finding the number of tuples $(x_1,\cdots ,x_y)$ such that $x_1+\cdots +x_y=k,$ where $0\leq x_i<10.$ Call this set $F_k(y),$ so $f_k(10^y)=|F_k(y)|.$ Call $A_i = \{(x_1,\cdots,x_i,\cdots ,x_y)\in A_k(y): x_i>9 \}.$ You want to avoid non digits. By the principle of inclusion-exclusion You want to compute then
$$|F_k(y)|=\left | A_k(y)\setminus \bigcup _{i = 1}^yA_i \right |=\binom{k+y-1}{k}-\sum _{i = 1}^y(-1)^{i-1}\sum _{1\leq j_1<\cdots <j_i\leq y}\left | A_{j_1}\cap \cdots \cap A_{j_i}\right |.$$
Notice that $|A_s|=\binom{k-10+y-1}{y-1}$ because $x_s=10+y_s$ with $y_s\geq 0$(we know that $x_s>9$ so we are calling $y_s=x_s-10$.) and so, in general, $| A_{j_1}\cap \cdots \cap A_{j_i}|=\binom{k-10\cdot i+y-1}{y-1}$ and so, replacing in the formula, we get
$$|F_k(y)|=\binom{k+y-1}{k}-\sum _{i = 1}^y(-1)^{i-1}\binom{y}{i}\binom{k-10\cdot i+y-1}{y-1}=\sum _{i = 0}^y(-1)^i\binom{y}{i}\binom{k-10\cdot i+y-1}{y-1}.$$
Notice, for example, that when $k< 10$ you get theorem 1.
