#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct FixPoint : F{ FixPoint(F&& f):F(forward(f)){} template decltype(auto) operator()(Args&&... args) const{ return F::operator()(*this,forward(args)...); } }; template inline decltype(auto) MFP(F&& f){ return FixPoint{forward(f)}; } //INSERT ABOVE HERE signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n,k; cin>>n>>k; vector as(n); for(int i=0;i>as[i]; sort(as.rbegin(),as.rend()); int ans=0; MFP([&](auto dfs,int i,int x)->void{ if(i==n){ chmax(ans,x%as.back()); return; } dfs(i+1,x); dfs(i+1,x%as[i]); })(0,k); cout<