#include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<ostream &operator<<(ostream &o,const vector&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<& a, vector& used, int& ans) { if (ans >= k) return; if (i >= n) { ans = max(ans, k); return; } for (int j=0; j= k%a[j]) continue; used[j] = true; dfs(i+1, n, k % a[j], a, used, ans); used[j] = false; } } int main() { int n,k; cin >> n >> k; vector a(n,0); for (int i=0; i> a[i]; int ans = 0; vector used(n,false); dfs(0,n,k,a,used,ans); cout << ans << endl; }