#include using namespace std; using ll = long long; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void dfs(int K, vector &A, vector &is_used, int &ans) { if(K < A[0]) { chmax(ans, K); return; } for(int i=0; i> N >> K; vector A(N); for(int i=0; i> A.at(i); sort(A.begin(), A.end()); A.erase(unique(A.begin(), A.end()), A.end()); vector is_used(A.size(), false); int ans = 0; dfs(K, A, is_used, ans); cout << ans << endl; return 0; }