#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); // int N = 20; // int K = 1000000000; // vector A(N); // std::mt19937 mt{ std::random_device{}() }; // auto randint = [&](int lower, int upper) // { // std::uniform_int_distribution dist(lower, upper); // return dist(mt); // }; // for(int i=0; i is_used(A.size(), false); int ans = 0; dfs(K, A, is_used, ans); cout << ans << endl; return 0; }