Subarrays With At Least N Distinct Integers
JavaScript (ES6), 93 bytes
Saved 18 bytes thanks to @user81655
Saved 2 bytes thanks to @tsh
Expects (N)(sequence).

n=&gt;C=a=&gt;eval('for(i=j=a.length,c=s=0;~j;c+=c&lt;n?(C[v=a[--j]]=-~C[v])&lt;2:-!--C[s-=~j,a[--i]])s')

Try it online!