Skip to main content
2 of 3
added 525 characters in body
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt, 16 12 bytes

@ZÔ¯V x}hVÆ1

Try it

@ZÔ¯V x}hVÆ1     :Implicit input of integers U=X & V=N
         VÆ1     :Map the range [0,V) returning 1 for each element
        h        :Push the result of the following to the array and repeat until its length equals U
@                :  Pass the array through the following function as Z
 ZÔ              :    Reverse Z
   ¯V            :    Slice to the Vth element
      x          :    Reduce by addition
       }         :  End function
Shaggy
  • 43.5k
  • 4
  • 36
  • 94