Haskell, 74 bytes
a#x=a!divMod x 10
a!(d,m)|d<1=a-m|m<=a=a-m+1#d|1>0=1
k=[x|x<-[0..],0==0#x]
- k is an infinite sequence
We start from the end checking if the last digit(m) doesn't consume more groups than available a
a-m>=0
Then we remove m
groups and add 1 a=a-m+1 and move backwards.
At the end we must have exactly one group a-m+1==1
3010200 m a a=a-m+1 0 0 1 0 1 2 2 2 1 0 1 2 1 2 2 0 2 3 3 3 1