Find the number of ways to climb a stairway
JavaScript (ES6), 71 bytes
Expects (list)(n).

(a,t=0)=&gt;g=n=&gt;n&gt;0?a.map(x=&gt;--g[(g[x]=-~g[x])+~x|x&lt;2&amp;&amp;g(n-x),x])|t:t+=!n

Try it online!
Commented
(a, t = 0) =&gt;           // a[] = input list, t = output
g = n =&gt;                // g is a recursive function taking the number of steps n
  n &gt; 0 ?               // if n is positive:
    a.map(x =&gt;          //   for each value x in a[]:
      --g[              //     decrement g[x] afterwards
        (g[x] = -~g[x]) //       increment g[x]
        + ~x |          //       if g[x] is not equal to x + 1
        x &lt; 2 &amp;&amp;        //       or x = 1:
          g(n - x),     //         do a recursive call with n - x
        x               //       actual index to update g[x]
      ]                 //     end of entry update: this is guaranteed to be 0 on
                        //     the first iteration; therefore, .map() is coerced to
                        //     0 by the the bitwise OR even if a[] is a singleton
    ) | t               //   end of map(); yield t
  :                     // else:
    t += !n             //   increment t if n = 0