//g++ 2.cpp -std=c++14 -O2 -I . #include using namespace std; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,k; cin>>n>>k; if(k==0){ cout<<0<>a[i]; } vvll prev(n+1); prev[0]={1}; rep(i,0,n){ vll x(k+1,0); x[0]++; x[a[i]]++; prev[i+1]=convolution(prev[i],x); while(prev[i+1].size()>1050){ prev[i+1].pop_back(); } } vvll afte(n); afte[0]={1}; rep(i,0,n-1){ vll x(k+1,0); x[0]++; x[a[n-1-i]]++; afte[i+1]=convolution(afte[i],x); while(afte[i+1].size()>1050){ afte[i+1].pop_back(); } } if(prev[n][k]==0){ cout<<-1<