#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
class BlurredDartboard { public:
int minThrows(vector <int> points, int P)
{
const int N = points.size();
int VisibleMax = *max_element(points.begin(), points.end());
vector<int> hidden;
for(int x=1; x<=N; ++x)
if( count(points.begin(), points.end(), x) == 0 )
hidden.push_back(x);
int K = hidden.size();
if( hidden.empty() || hidden.back() < VisibleMax )
return (P+VisibleMax-1) / VisibleMax;
partial_sum(hidden.begin(), hidden.end(), hidden.begin());
vector<int> vis;
for(int i=1; i<=K; ++i)
vis.push_back(i*VisibleMax);
int turn = max(vis.back(), hidden.back());
int n = (P/turn)*K;
if(P%turn) {
++n;
for(int i=0; max(vis[i],hidden[i]) < (P%turn); ++i)
++n;
}
return n;
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
bool ok = (Expected == Received);
if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl;
cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END verify_case(_, BlurredDartboard().minThrows(points, P));}
int main(){
CASE(0)
int points_[] = {0, 3, 4, 0, 0};
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = 8;
int _ = 2;
END
CASE(1)
int points_[] = {0, 0, 0, 0, 0};
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = 15;
int _ = 5;
END
CASE(2)
int points_[] = {4, 7, 8, 1, 3, 2, 6, 5};
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = 2012;
int _ = 252;
END
CASE(3)
int points_[] = {0, 0, 5, 0, 0, 0, 1, 3, 0, 0};
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = 2012;
int _ = 307;
END
CASE(4)
int points_[] = {0, 2, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0};
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = 1000000000;
int _ = 84656087;
END
CASE(5)
int points_[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = 1000000000;
int _ = -1;
END
/*
CASE(6)
int points_[] = ;
vector <int> points(points_, points_+sizeof(points_)/sizeof(*points_));
int P = ;
int _ = ;
END
*/
}
// END CUT HERE