링크 : https://www.acmicpc.net/problem/16435
/*
문제 : 스네이크버드
링크 : https://www.acmicpc.net/problem/16435
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, s;
cin >> n >> s;
vector<int> v;
for(int i = 0, tmp ; i < n; i++){
cin >> tmp;
v.push_back(tmp);
}
sort(v.begin(), v.end());
for(int i : v){
if(i > s) break;
else s += 1;
}
cout << s;
return 0;
}