#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1, s2;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
		s2.insert(x);
	}
	int min = s.size();

	if (min == 2) {
		auto it = s.begin();
		if (-(*it) + (*(++it)) < 3)
			min--;
	}

	for (auto it = ++s.begin(); it != --s.end() && it != s.end(); ) {
		int x = *(--it);
		int y = *(++it);
		int z = *(++it);
		if (y==x+1 && z==y+1) {
			min-=2;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}
		else if (y == x + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
		}

		else if (z == y + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}

	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1, s2;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
		s2.insert(x);
	}
	int min = s.size();

	for (auto it = ++s.begin(); it != --s.end() && it != s.end(); ) {
		int x = *(--it);
		int y = *(++it);
		int z = *(++it);
		if (y==x+1 && z==y+1) {
			min-=2;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}
		else if (y == x + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
		}

		else if (z == y + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}

	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
	}
	int min = s.size();

	for (auto it = s.begin(); it != s.end() && it != ++s.end(); ) {
		if (-(*it) + (*(++it)) == 1) {
			min--;
			it++;
		}
	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
	}
	int min = 0;

	fr(i, 1, n) {
		if (freq[i])
			min++, i += 2;
	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
	}
	int min = s.size();

	for (auto it = s.begin(); it != --s.end() && it!=s.end() ; ) {
		int y = *it;
		int z = *(++it);
		if (z-y == 1) {
			min--;
			it++;
		}
	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1, s2;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
		s2.insert(x);
	}
	int min = s.size();

	if (min == 2) {
		auto it = s.begin();
		if (-(*it) + (*it++) < 3)
			min--;
	}

	for (auto it = ++s.begin(); it != --s.end() && it != s.end(); ) {
		int x = *(--it);
		int y = *(++it);
		int z = *(++it);
		if (y==x+1 && z==y+1) {
			min-=2;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}
		else if (y == x + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
		}

		else if (z == y + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}

	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1, s2;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
		s2.insert(x);
	}
	int min = s.size();

	if (min == 2) {
		auto it = s.begin();
		int x = *it;
		int y = *(++it);
		if (y-x < 3)
			min--;
	}

	for (auto it = ++s.begin(); it != --s.end() && it != s.end(); ) {
		int x = *(--it);
		int y = *(++it);
		int z = *(++it);
		if (y==x+1 && z==y+1) {
			min-=2;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}
		else if (y == x + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
		}

		else if (z == y + 1) {
			min--;
			it++;
			if (it == s.end())
				break;
			it++;
			if (it == s.end())
				break;
		}

	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const int mod = 998244353;
//const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;

//const int N = 2e5+5;

void solve() {

	int n;
	cin >> n;
	vi freq(n+2,0);
	si s, s1;

	fr(i, 1, n) {
		int x;
		cin >> x;
		freq[x]++;
		s.insert(x);
	}
	int min = s.size();

	for (auto it = s.begin(); it != s.end() && it != ++s.end(); ) {
		if (-(*it) + (*(++it)) == 1) {
			min--;
			it++;
		}
	}

	for (auto it = s.begin(); it != s.end(); it++) {

		int y = *it;
		int f =  freq[y];
		if (!s1.count(y-1)) {
			s1.insert(y-1);
			f--;
		}
		if (f > 0 && !s1.count(y)) {
			s1.insert(y);
			f--;
		}
		if (f > 0 && !s1.count(y+1)) {
			s1.insert(y+1);
			f--;
		}
	}

	int max = s1.size();

	cout << min << " " << max;

}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(12);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef rd
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

int divide(int a, int b) {
	return ((a % mod) * powm(b, mod - 2)) % mod;
}

int mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int add(int a, int b) {
	return (a % mod + b % mod) % mod;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    map<ll,ll> m,md;ll n,i,j,k,house=0,housemin,housemax;vector<ll> v;
    cin >> n ;
    for(i=1;i<=n;i++)
    {
        cin >> k;
        if(m[k]==0)m[k]++,house++,v.push_back(k);
        md[k]++;
    }
    housemin = housemax = house;
    sort(v.begin(),v.end());
    ll s = v.size();
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(m[i]==1)
        {
            if(m[i-1]>0)housemin--,m[i]--,m[i-1]++;
            else if(m[i+1]>0)housemin--,m[i]--,m[i+1]++;
            else if(m[i+1]==0)m[i]--,m[i+1]=2;
        }
    }
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(md[i]>=1)
        {
            if(md[i]==1&&md[i-1]==0)md[i]--,md[i-1]++;
            else if(md[i]>1&&md[i-1]==0)md[i]--,md[i-1]++,housemax++;
            if(md[i]==1&&md[i+1]==0&&md[i-1]>1)
            {
                housemax++,md[i]--,md[i+1]++,md[i-1]--;md[i]++;
            }
            else if(md[i]>1&&md[i+1]==0)housemax++,md[i]--,md[i+1]++;
        }
    }
    cout << housemin << ' ' << housemax << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200009;
ll a[mod],b[mod],k1[mod],k2[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2,mn3;
    mx = mn = mn1 = mn2 = mn3 = 0;
    cin >> n;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k1[e]++; k2[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,1,n+5,3)
    {
        if(k1[i+1]>0||k1[i-1]>0||k1[i]>0)mn1++;
    }
    fi(i,2,n+5,3)
    {
        if(k2[i+1]>0||k2[i-1]>0||k2[i]>0)mn2++;
    }
    if(k2[1])mn3++;
    fi(i,3,n+5,3)if(k2[i+1]>0||k2[i-1]>0||k2[i]>0)mn3++;
    mn1 = min(mn1,mn3);
    mn = min(mn1,mn2);
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200005;
ll a[mod],b[mod],k[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2;
    mx = mn = mn1 = mn2 = 0;
    cin >> n;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,1,n,2)
    {
        if(k[i+1]>0||k[i-1]>0||k[i]>0)mn1++;
    }
    fi(i,2,n,2)
    {
        if(k[i+1]>0||k[i-1]>0||k[i]>0)mn2++;
    }
    mn = min(mn1,mn2);
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200009;
ll a[mod],b[mod],k1[mod],k2[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2;
    mx = mn = mn1 = mn2 = 0;
    cin >> n;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k1[e]++; k2[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,1,n+5,3)
    {
        if(k1[i+1]>0||k1[i-1]>0||k1[i]>0)mn1++;
    }
    fi(i,2,n+5,3)
    {
        if(k2[i+1]>0||k2[i-1]>0||k2[i]>0)mn2++;
    }
    mn = min(mn1,mn2);
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200020;
ll a[mod],b[mod],k[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2,mn3;
    mx = mn = 0;
    cin >> n;
    fi(i,0,n+1,1)a[i] = b[i] = k[i] = 0;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,0,n,1)
    {
        if(k[i]>0)
        {
            if(k[i+1]==0&&k[i+2]==0)mn++,i+=2;
            else if(k[i+1]==0&&k[i+2]>0)mn++,i+=2;
            else if(k[i+1]>0&&k[i+2]==0)mn++,i+=2;
            else if(k[i+1]>0&&k[i+2]>0)mn++,i+=2;
        }
    }
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    map<ll,ll> m,md;ll n,i,j,k,house=0,housemin,housemax;vector<ll> v;
    cin >> n ;
    for(i=1;i<=n;i++)
    {
        cin >> k;
        if(m[k]==0)m[k]++,house++,v.push_back(k);
        md[k]++;
    }
    housemin = housemax = house;
    sort(v.begin(),v.end());
    ll s = v.size();
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(m[i]==1)
        {
            if(m[i-1]==1)housemin--,m[i]--,m[i-1]++;
            else if(m[i+1]==1)housemin--,m[i]--,m[i+1]++;
        }
    }
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(md[i]>1)
        {
            if(md[i-1]==0)housemax++,md[i]--,md[i-1]++;
            if(md[i+1]==0&&md[i]>1)housemax++,md[i]--,md[i+1]++;
            //cout << housemax << endl;
        }
    }
    cout << housemin << ' ' << housemax << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200005;
ll a[mod],b[mod],k1[mod],k2[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2;
    mx = mn = mn1 = mn2 = 0;
    cin >> n;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k1[e]++; k2[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,1,n+5,3)
    {
        if(k1[i+1]>0||k1[i-1]>0||k1[i]>0)mn1++;
    }
    fi(i,2,n+5,3)
    {
        if(k2[i+1]>0||k2[i-1]>0||k2[i]>0)mn2++;
    }
    mn = min(mn1,mn2);
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200020;
ll a[mod],b[mod],k[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2,mn3;
    mx = mn = 0;
    cin >> n;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,1,n,1)
    {
        if(k[i]>0&&k[i-1]>0&&k[i+1]>0)mn++,k[i]=k[i+1]=k[i-1]=0;
    }
    fi(i,1,n,1)
    {
        if(k[i]>0&&k[i-1]>0)mn++,k[i]=k[i-1]=0;
    }
    fi(i,1,n,1)
    {
        if(k[i]>0)mn++;
    }
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef deque<ll> dl;
typedef deque<string> ds;
typedef map<ll,ll> mll;
typedef map<string,ll> msl;
typedef map<ll,string> mls;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
typedef priority_queue<ll> pql;
typedef priority_queue<string> pqs;
#define mp make_pair
#define pb push_back
#define pf push_front
#define db pop_back
#define df pop_front
#define gc getchar()
#define ce cout << endl
#define cs cout << ' '
#define c(x) cout << x
#define ff first
#define ss second
#define s(x) x.size()
#define all(x) x.begin(), x.end()
#define unix(v) v.resize(unique(all(v)) - v.begin())
#define fi(i,a,n,inc) for(i=a;i<=n;i+=inc)
#define fd(i,a,n,dec) for(i=a;i>=n;i-=dec)
const ll inf = LLONG_MAX;
const ld pi  = acos(-1);
const ll mod = 200020;
ll a[mod],b[mod],k[mod];
int main()
{
    ll n,i,mx,mn,mn1,mn2,mn3;
    mx = mn = 0;
    cin >> n;
    fi(i,1,n,1)
    {
        ll e;
        cin >> e; a[e]++;
        k[e]++;
    }
    fi(i,0,n+1,1){
        if(i>0&&a[i-1]>0)b[i]=1,a[i-1]--,mx++;
        else if(a[i]>0)b[i]=1,a[i]--,mx++;
        else if(a[i+1]>0)b[i]=1,a[i+1]--,mx++;
    }
    fi(i,1,n,1)
    {
        if(k[i]>0&&k[i-1]>0&&k[i+1]>0)mn++,k[i]=k[i+1]=k[i-1]=0;
    }
    fi(i,1,n,1)
    {
        if(k[i]>0&&k[i-1]>0)mn++,k[i]=k[i-1]=0;
        else if(k[i-1]>0&&k[i+1]>0)mn++,k[i-1]=k[i+1]=0;
    }
    fi(i,1,n,1)
    {
        if(k[i]>0)mn++;
    }
    c(mn); cs; c(mx); ce;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    map<ll,ll> m,md;ll n,i,j,k,house=0,housemin,housemax;vector<ll> v;
    cin >> n ;
    for(i=1;i<=n;i++)
    {
        cin >> k;
        if(m[k]==0)m[k]++,house++,v.push_back(k);
        md[k]++;
    }
    housemin = housemax = house;
    sort(v.begin(),v.end());
    ll s = v.size();
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(m[i]==1)
        {
            if(m[i-1]>0)housemin--,m[i]--,m[i-1]++;
            else if(m[i+1]>0)housemin--,m[i]--,m[i+1]++;
        }
    }
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(md[i]>=1)
        {
            if(md[i-1]==0){md[i]--,md[i-1]++;if(md[i]>0)housemax++;}
            if(md[i+1]==0&&md[i]>1)housemax++,md[i]--,md[i+1]++;
        }
    }
    cout << housemin << ' ' << housemax << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    map<ll,ll> m,md;ll n,i,j,k,house=0,housemin,housemax;vector<ll> v;
    cin >> n ;
    for(i=1;i<=n;i++)
    {
        cin >> k;
        if(m[k]==0)m[k]++,house++,v.push_back(k);
        md[k]++;
    }
    housemin = housemax = house;
    sort(v.begin(),v.end());
    ll s = v.size();
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(m[i]==1)
        {
            if(m[i-1]>0)housemin--,m[i]--,m[i-1]++;
            else if(m[i+1]>0)housemin--,m[i]--,m[i+1]++;
        }
    }
    for(j=0;j<s;j++)
    {
        i = v[j];
        if(md[i]>1)
        {
            if(md[i-1]==0)housemax++,md[i]--,md[i-1]++;
            if(md[i+1]==0&&md[i]>1)housemax++,md[i]--,md[i+1]++;
        }
    }
    cout << housemin << ' ' << housemax << endl;
}


#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
map <int,int> mp, done, ans;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	for (auto x : mp)
	{
		if(done[x.first]) continue;

		if(mp.count(x.first+1))
			done[x.first+1] = 1;
		if(mp.count(x.first+2))
			done[x.first+2] = 1;

		t++;
	}

	for (auto x : mp)
	{
		if(ans[x.first-1] == 0 && x.second > 0)
		{
			ans[x.first-1] = 1;
			x.second--;
		}

		if(ans[x.first] == 0 && x.second > 0)
		{
			ans[x.first] = 1;
			x.second--;
		}

		if(ans[x.first+1] == 0 && x.second > 0)
		{
			ans[x.first+1] = 1;
			x.second--;
		}
	}

	for (auto x : ans)
		k += (x.second != 0);
	cout << t _ k << endl;
}


#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
map <int,int> mp, done, ans;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	// MIN
	for (auto x : mp)
	{
		if(done[x.first]) continue;

		if(mp.count(x.first+1))
			done[x.first+1] = 1;
		if(mp.count(x.first+2))
			done[x.first+2] = 1;

		t++;
	}

	// MAX
	for (auto x : mp)
	{
		if(ans[x.first-1] == 0 && x.second > 0)
		{
			ans[x.first-1] = 1;
			x.second--;
		}

		if(ans[x.first] == 0 && x.second > 0)
		{
			ans[x.first] = 1;
			x.second--;
		}

		if(ans[x.first+1] == 0 && x.second > 0)
		{
			ans[x.first+1] = 1;
			x.second--;
		}
	}

	for (auto x : ans)
		k += (x.second != 0);
	cout << t _ k << endl;
}


#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,m;
vector <int> v[MAXN];
vector <int> d[MAXN];
int path[MAXN];
int k;
int dist[MAXN];

int minn;
int extra;

// find all dist to all nodes from path[k-1]
void bfs()
{
	for (int i = 1; i <= n; ++i)
		dist[i] = -1;

	priority_queue <pii, vector<pii>, greater<pii>> q;
	q.push({0, path[k-1]});
	dist[path[k-1]] = 0;
	while(!q.empty())
	{
		auto tmp = q.top();q.pop();

		for (int i = 0; i < v[tmp.second].size(); ++i)
		{
			auto nn = v[tmp.second][i];

			if(dist[nn] != -1)	continue;

			dist[nn] = tmp.first + 1;
			q.push({dist[nn], nn});
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);

	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int a,b;
		cin >> a >> b;
		v[b].pb(a);
		d[a].pb(b);
	}

	cin >> k;
	for (int i = 0; i < k; ++i)
		cin >> path[i];

	bfs();

	for (int i = 1; i < k-1; ++i)
	{
		int sm = INF;
		for (int j = 0; j < d[path[i-1]].size(); ++j)
		{
			if(d[path[i-1]][j] == path[i]) continue;
			sm = min(sm, dist[d[path[i-1]][j]]);
		}

		if(sm < dist[path[i]])
			minn++;
		else if(sm == dist[path[i]])
			extra++;
	}

	cout << minn _ (minn + extra) << endl;
}


#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
unordered_map <int,int> mp, done, ans;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	for (auto x : mp)
	{
		if(done[x.first]) continue;

		if(mp.count(x.first+1))
			done[x.first+1] = 1;
		if(mp.count(x.first+2))
			done[x.first+2] = 1;

		t++;
	}

	for (auto x : mp)
	{
		if(ans[x.first-1] == 0 && x.second > 0)
		{
			ans[x.first-1] = 1;
			x.second--;
		}

		if(ans[x.first] == 0 && x.second > 0)
		{
			ans[x.first] = 1;
			x.second--;
		}

		if(ans[x.first+1] == 0 && x.second > 0)
		{
			ans[x.first+1] = 1;
			x.second--;
		}
	}

	for (auto x : ans)
		k += (x.second != 0);
	cout << t _ k << endl;
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
int mp[MAXN], done[MAXN], ans[MAXN];

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	// MIN
	for (int i = 1; i < MAXN-2; ++i)
	{
		if(done[i]) continue;

		if(mp[i+1])
			done[i+1] = 1;
		if(mp[i+2])
			done[i+2] = 1;

		t++;
	}

	// MAX
	ans[0] = 1;
	for (int i = 1; i < MAXN-2; ++i)
	{
		int fill = i-1;
		while(mp[i] > 0 && fill < i+2)
		{
			if(ans[fill] == 0)
			{
				ans[fill] = 1;
				mp[i]--;
			}

			fill++;
		}
	}

	for (int i = 1; i < MAXN-2; ++i)
		k += (ans[i]);

	cout << t _ k << endl;
}


#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
map <int,int> mp, done, ans;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	for (auto x : mp)
	{
		if(done[x.first]) continue;

		if(mp.count(x.first+1))
		{
			done[x.first] = 1;
			done[x.first+1] = 1;
			if(mp.count(x.first+2))
				done[x.first+2] = 1;
		}

		t++;
	}

	for (auto x : mp)
	{
		if(ans[x.first-1] == 0 && x.second > 0)
		{
			ans[x.first-1] = 1;
			x.second--;
		}

		if(ans[x.first] == 0 && x.second > 0)
		{
			ans[x.first] = 1;
			x.second--;
		}

		if(ans[x.first+1] == 0 && x.second > 0)
		{
			ans[x.first+1] = 1;
			x.second--;
		}
	}

	for (auto x : ans)
		k += (x.second != 0);
	cout << t _ k << endl;
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
int mp[MAXN], done[MAXN], ans[MAXN];

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	// MIN
	for (int i = 1; i < MAXN-2; ++i)
	{
		if(done[x.first]) continue;

		if(mp[x.first+1])
			done[x.first+1] = 1;
		if(mp[x.first+2])
			done[x.first+2] = 1;

		t++;
	}

	// MAX
	ans[0] = 1;
	for (int i = 1; i < MAXN-2; ++i)
	{
		int fill = i-1;
		while(mp[i] > 0 && fill < i+2)
		{
			if(ans[fill] == 0)
			{
				ans[fill] = 1;
				mp[i]--;
			}

			fill++;
		}
	}

	for (int i = 1; i < MAXN-2; ++i)
		k += (ans[i]);

	cout << t _ k << endl;
}


#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
unordered_map <int,int> mp, done, ans;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;
	}

	// MIN
	for (auto x : mp)
	{
		if(done[x.first]) continue;

		if(mp.count(x.first+1))
			done[x.first+1] = 1;
		if(mp.count(x.first+2))
			done[x.first+2] = 1;

		t++;
	}

	// MAX
	for (auto x : mp)
	{
		if(ans[x.first-1] == 0 && x.second > 0)
		{
			ans[x.first-1] = 1;
			x.second--;
		}

		if(ans[x.first] == 0 && x.second > 0)
		{
			ans[x.first] = 1;
			x.second--;
		}

		if(ans[x.first+1] == 0 && x.second > 0)
		{
			ans[x.first+1] = 1;
			x.second--;
		}
	}

	for (auto x : ans)
		k += (x.second != 0);

	cout << t _ k << endl;
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}
#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
int mp[MAXN], done[MAXN], ans[MAXN];
int last;
int first = INF;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;

		last = max(last, a);
		first = min(first, a);
	}

	// MIN
	for (int i = 1; i <= last; ++i)
	{
		if(done[i]) continue;

		if(mp[i+1])
			done[i+1] = 1;
		if(mp[i+2])
			done[i+2] = 1;

		TRACE(i, done[i], mp[i+1], mp[i+2]);
		t++;
	}

	// MAX
	ans[0] = 1;
	for (int i = 1; i < MAXN-2; ++i)
	{
		int fill = i-1;
		while(mp[i] > 0 && fill < i+2)
		{
			if(ans[fill] == 0)
			{
				ans[fill] = 1;
				mp[i]--;
			}

			fill++;
		}
	}

	for (int i = 1; i < MAXN-2; ++i)
		k += (ans[i]);

	cout << t _ k << endl;
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,t,k;
int mp[MAXN], done[MAXN], ans[MAXN];
int last;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		mp[a]++;

		last = max(last, a);
	}

	// MIN
	for (int i = 1; i <= last; ++i)
	{
		if(done[i]) continue;

		if(mp[i+1])
			done[i+1] = 1;
		if(mp[i+2])
			done[i+2] = 1;

		t++;
	}

	// MAX
	ans[0] = 1;
	for (int i = 1; i < MAXN-2; ++i)
	{
		int fill = i-1;
		while(mp[i] > 0 && fill < i+2)
		{
			if(ans[fill] == 0)
			{
				ans[fill] = 1;
				mp[i]--;
			}

			fill++;
		}
	}

	for (int i = 1; i < MAXN-2; ++i)
		k += (ans[i]);

	cout << t _ k << endl;
}


#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define ull unsigned long long
#define mymax(a,b) (a<b?b:a)
#define mymin(a,b) (a>b?b:a)
#define myswap(a,b) a^=b^=a^=b
#define sync ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(x)cout<<"debug:  "<<x<<endl
#define debug2(i,x)cout<<"debug2:  "<<i<<' '<<x<<endl
#define debug3(a,b,c)cout<<"debug3:  "<<a<<' '<<b<<' '<<c<<endl
#define debug4(a,b,c,d)cout<<"debug4:  "<<a<<' '<<b<<' '<<c<<' '<<d<<endl
#define debugxy(x,y)cout<<'('<<x<<','<<y<<')'<<endl
#define Init(a,v) memset(a,v,sizeof(a))
//#define fir first
//#define sec second
//#define fi0(n) for(int i=0;i<n;++i)
//#define forr(i,t) for(int i=t;i<26;++i)
//#define int long long
const int N=2e5+10;
const int mod=998244353;
const double pi=3.14159265358979;
const double eps=1.0E-8;
using namespace std;
//ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
//inline ll fast_mult(ll a,ll b){return (a*b-(ll)((long double)a/mod*b)*mod+mod)%mod;}
//ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
//ll qpow(ll a,ll b){ll ans=1; a%=mod; for(;b;b>>=1,a=a*a%mod) if(b&1)ans=(ans*a)%mod; return ans;}
//inline int read(){int num = 0, w = 0; char ch = 0;while (!isdigit(ch)){w |= ch == '-';ch = getchar();}while (isdigit(ch)){num = (num << 3) + (num << 1) + (ch ^ 48);ch = getchar();}return w ? -num : num;}
int n,a[N],cnt[N],cnt2[N],dpx[N],dpi[N];
int main()
{
	sync;
	cin>>n;
	for(int i=0;i<n;++i)
    {
        cin>>a[i];
        cnt[a[i]]++,cnt2[a[i]]++;
    }
	for(int i=1;i<=n;++i)
    {
        if(cnt[i]>2)
            cnt[i]-=2,cnt[i+1]++,cnt[i-1]++;
        else if(cnt[i]>1)
        {
            if(cnt[i-1]==0)cnt[i-1]++;
            else if(cnt[i+1]==0)cnt[i+1]++;
            cnt[i]=1;
        }

        if(i<n &&cnt2[i]>0 && cnt2[i+2]>0)
            cnt2[i]=cnt2[i+2]=0,cnt2[i+1]=-1;
        else if(cnt2[i]>0 && cnt2[i+1]>0)
            cnt2[i+1]=0,cnt2[i]=-1;
    }
//    for(int i=n+1;i>=1;--i)
//    {
//        if(cnt[i]==0 && cnt[i-1]>0)
//            cnt[i]=1,cnt[i-1]--;
//    }
    int mx=0,mi=0;
    for(int i=0;i<=n+1;++i)
    {
        cout<<cnt[i]<<' ';
        if(cnt[i]!=0)++mx;
        if(cnt2[i]!=0)++mi;
    }
    cout<<mi<<' '<<mx;
	return 0;
}
/*

10
6 8 9 6 5 9 4 8 8 6

10
8 8 1 1 1 2 7 7 8 4

*/


#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define ull unsigned long long
#define mymax(a,b) (a<b?b:a)
#define mymin(a,b) (a>b?b:a)
#define myswap(a,b) a^=b^=a^=b
#define sync ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(x)cout<<"debug:  "<<x<<endl
#define debug2(i,x)cout<<"debug2:  "<<i<<' '<<x<<endl
#define debug3(a,b,c)cout<<"debug3:  "<<a<<' '<<b<<' '<<c<<endl
#define debug4(a,b,c,d)cout<<"debug4:  "<<a<<' '<<b<<' '<<c<<' '<<d<<endl
#define debugxy(x,y)cout<<'('<<x<<','<<y<<')'<<endl
#define Init(a,v) memset(a,v,sizeof(a))
//#define fir first
//#define sec second
//#define fi0(n) for(int i=0;i<n;++i)
//#define forr(i,t) for(int i=t;i<26;++i)
//#define int long long
const int N=2e5+10;
const int mod=998244353;
const double pi=3.14159265358979;
const double eps=1.0E-8;
using namespace std;
//ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
//inline ll fast_mult(ll a,ll b){return (a*b-(ll)((long double)a/mod*b)*mod+mod)%mod;}
//ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
//ll qpow(ll a,ll b){ll ans=1; a%=mod; for(;b;b>>=1,a=a*a%mod) if(b&1)ans=(ans*a)%mod; return ans;}
//inline int read(){int num = 0, w = 0; char ch = 0;while (!isdigit(ch)){w |= ch == '-';ch = getchar();}while (isdigit(ch)){num = (num << 3) + (num << 1) + (ch ^ 48);ch = getchar();}return w ? -num : num;}
int n,a[N],cnt[N],cnt2[N],dpx[N],dpi[N];
int main()
{
	sync;
	cin>>n;
	for(int i=0;i<n;++i)
    {
        cin>>a[i];
        cnt[a[i]]++,cnt2[a[i]]++;
    }
	for(int i=1;i<=n;++i)
    {
        if(cnt[i]>2)
            cnt[i]-=2,cnt[i+1]++,cnt[i-1]++;
        else if(cnt[i]>1)
        {
            if(cnt[i-1]==0)cnt[i-1]++;
            else if(cnt[i+1]==0)cnt[i+1]++;
            cnt[i]=1;
        }

        if(i<n &&cnt2[i]>0 && cnt2[i+2]>0)
            cnt2[i]=cnt2[i+2]=0,cnt2[i+1]=-1;
        else if(cnt2[i]>0 && cnt2[i+1]>0)
            cnt2[i+1]=0,cnt2[i]=-1;
    }
//    for(int i=n+1;i>=1;--i)
//    {
//        if(cnt[i]==0 && cnt[i-1]>0)
//            cnt[i]=1,cnt[i-1]--;
//    }
    int mx=0,mi=0;
    for(int i=0;i<=n+1;++i)
    {
        //cout<<cnt[i]<<' ';
        if(cnt[i]!=0)++mx;
        if(cnt2[i]!=0)++mi;
    }
    cout<<mi<<' '<<mx;
	return 0;
}
/*

10
6 8 9 6 5 9 4 8 8 6

10
8 8 1 1 1 2 7 7 8 4

*/


#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define ull unsigned long long
#define mymax(a,b) (a<b?b:a)
#define mymin(a,b) (a>b?b:a)
#define myswap(a,b) a^=b^=a^=b
#define sync ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(x)cout<<"debug:  "<<x<<endl
#define debug2(i,x)cout<<"debug2:  "<<i<<' '<<x<<endl
#define debug3(a,b,c)cout<<"debug3:  "<<a<<' '<<b<<' '<<c<<endl
#define debug4(a,b,c,d)cout<<"debug4:  "<<a<<' '<<b<<' '<<c<<' '<<d<<endl
#define debugxy(x,y)cout<<'('<<x<<','<<y<<')'<<endl
#define Init(a,v) memset(a,v,sizeof(a))
//#define fir first
//#define sec second
//#define fi0(n) for(int i=0;i<n;++i)
//#define forr(i,t) for(int i=t;i<26;++i)
//#define int long long
const int N=2e5+10;
const int mod=998244353;
const double pi=3.14159265358979;
const double eps=1.0E-8;
using namespace std;
//ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
//inline ll fast_mult(ll a,ll b){return (a*b-(ll)((long double)a/mod*b)*mod+mod)%mod;}
//ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
//ll qpow(ll a,ll b){ll ans=1; a%=mod; for(;b;b>>=1,a=a*a%mod) if(b&1)ans=(ans*a)%mod; return ans;}
//inline int read(){int num = 0, w = 0; char ch = 0;while (!isdigit(ch)){w |= ch == '-';ch = getchar();}while (isdigit(ch)){num = (num << 3) + (num << 1) + (ch ^ 48);ch = getchar();}return w ? -num : num;}
int n,a[N],cnt[N],cnt2[N],dpx[N],dpi[N];
int main()
{
	sync;
	cin>>n;
	for(int i=0;i<n;++i)
    {
        cin>>a[i];
        cnt[a[i]]++,cnt2[a[i]]++;
    }
	for(int i=0;i<=n;++i)
    {
        if(cnt[i]==0 && cnt[i+1]>0)
            cnt[i]=1,cnt[i+1]--;

        if(i<n &&cnt2[i]>0 && cnt2[i+2]>0)
            cnt2[i]=cnt2[i+2]=0,cnt2[i+1]=-1;
        else if(cnt2[i]>0 && cnt2[i+1]>0)
            cnt2[i+1]=0,cnt2[i]=-1;
    }
    for(int i=n+1;i>=1;--i)
    {
        if(cnt[i]==0 && cnt[i-1]>0)
            cnt[i]=1,cnt[i-1]--;
    }
    int mx=0,mi=0;
    for(int i=0;i<=n+1;++i)
    {
        //cout<<cnt[i]<<' ';
        if(cnt[i]!=0)++mx;
        if(cnt2[i]!=0)++mi;
    }
    cout<<mi<<' '<<mx;
	return 0;
}
/*

10
6 8 9 6 5 9 4 8 8 6

10
8 8 1 1 1 2 7 7 8 4

*/


#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define ull unsigned long long
#define mymax(a,b) (a<b?b:a)
#define mymin(a,b) (a>b?b:a)
#define myswap(a,b) a^=b^=a^=b
#define sync ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(x)cout<<"debug:  "<<x<<endl
#define debug2(i,x)cout<<"debug2:  "<<i<<' '<<x<<endl
#define debug3(a,b,c)cout<<"debug3:  "<<a<<' '<<b<<' '<<c<<endl
#define debug4(a,b,c,d)cout<<"debug4:  "<<a<<' '<<b<<' '<<c<<' '<<d<<endl
#define debugxy(x,y)cout<<'('<<x<<','<<y<<')'<<endl
#define Init(a,v) memset(a,v,sizeof(a))
//#define fir first
//#define sec second
//#define fi0(n) for(int i=0;i<n;++i)
//#define forr(i,t) for(int i=t;i<26;++i)
//#define int long long
const int N=2e5+10;
const int mod=998244353;
const double pi=3.14159265358979;
const double eps=1.0E-8;
using namespace std;
//ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
//inline ll fast_mult(ll a,ll b){return (a*b-(ll)((long double)a/mod*b)*mod+mod)%mod;}
//ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
//ll qpow(ll a,ll b){ll ans=1; a%=mod; for(;b;b>>=1,a=a*a%mod) if(b&1)ans=(ans*a)%mod; return ans;}
//inline int read(){int num = 0, w = 0; char ch = 0;while (!isdigit(ch)){w |= ch == '-';ch = getchar();}while (isdigit(ch)){num = (num << 3) + (num << 1) + (ch ^ 48);ch = getchar();}return w ? -num : num;}
int n,a[N],cnt[N],cnt2[N],dpx[N],dpi[N];
int main()
{
	sync;
	cin>>n;
	for(int i=0;i<n;++i)
    {
        cin>>a[i];
        cnt[a[i]]++,cnt2[a[i]]++;
    }
	for(int i=1;i<=n;++i)
    {
        if(cnt[i]==0 && cnt[i+1]>0)
            cnt[i]=-1,cnt[i+1]--;

        if(i<n &&cnt2[i]>0 && cnt2[i+2]>0)
            cnt2[i]=cnt2[i+2]=0,cnt2[i+1]=-1;
        else if(cnt2[i]>0 && cnt2[i+1]>0)
            cnt2[i+1]=0,cnt2[i]=-1;
    }
    for(int i=n+1;i>=1;--i)
    {
        if(cnt[i]==0 && cnt[i-1]>0)
            cnt[i]=-1,cnt[i-1]--;
    }
    int mx=0,mi=0;
    for(int i=0;i<=n+1;++i)
    {
        //cout<<cnt2[i]<<' ';
        if(cnt[i]!=0)++mx;
        if(cnt2[i]!=0)++mi;
    }
    cout<<mi<<' '<<mx;
	return 0;
}
/*

10
6 8 9 6 5 9 4 8 8 6

*/


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    int a[maxn];
    ll Min=1e9+1,k=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]<Min)
            Min=a[i];
        if(t>=a[i]){
            t-=a[i];
            k++;
        }
    }
    while(t>=Min){
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                t-=a[i];
                k++;
            }
        }
    }
    cout<<k;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    int a[maxn];
    ll Min=1e9+1,k=0,sum=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
        if(a[i]<Min)
            Min=a[i];
        if(t>=a[i]){
            t-=a[i];
            k++;
        }
    }
    if(t>=sum){
        ll p=t/sum;
        t%=sum;
        k+=(k*p);
    }
    if(t>=Min){
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                t-=a[i];
                k++;
            }
        }
    }
    cout<<k;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    ll a[maxn];
    ll Min=1e9+1,k=0,sum=0,q=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(t>=a[i])
            sum+=a[i],q++;
        if(a[i]<Min)
            Min=a[i];
    }
    if(t>=sum){
        ll p=t/sum;
        t=t%sum;
        k+=(q*p);
    }
    if(t>=Min){
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                t-=a[i];
                k++;
            }
        }
    }
    cout<<k;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    ll a[maxn];
    ll Min=1e9+1,k=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    while(1){
        ll sum=0,q=0;
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                sum+=a[i];
                t-=a[i];
                q++;
            }
        }
        k+=q;
        if(sum==0)break;
        k+=(t/sum)*q;
        t%=sum;
    }
    cout<<k;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    ll a[maxn];
    ll Min=1e9+1,k=0,sum=0,y=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(t>=a[i])
            sum+=a[i],y++;
        if(a[i]<Min)
            Min=a[i];
    }
    if(t>=sum){
        ll p=t/sum;
        t=t%sum;
        k+=(y*p);
    }
    if(t>=Min){
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                t-=a[i];
                k++;
            }
        }
    }
    cout<<k;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    ll a[maxn];
    ll Min=1e9+1,k=0,sum=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
        if(a[i]<Min)
            Min=a[i];
        if(t>=a[i]){
            t-=a[i];
            k++;
        }
    }
    if(t>=sum){
        ll p=t/sum;
        t=t%sum;
        k+=(n*p);
    }
    if(t>=Min){
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                t-=a[i];
                k++;
            }
        }
    }
    cout<<k;
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn (int)2e5+5
#define ll long long
const int mod=998244353;
using namespace std;
int main(){
    ll n,t;
    cin>>n>>t;
    ll a[maxn];
    ll Min=1e9+1,k=0,sum=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
        if(a[i]<Min)
            Min=a[i];
    }
    if(t>=sum){
        ll p=t/sum;
        t=t%sum;
        k+=(n*p);
    }
    if(t>=Min){
        for(int i=1;i<=n;i++){
            if(t>=a[i]){
                t-=a[i];
                k++;
            }
        }
    }
    cout<<k;
    return 0;
}


#include <cstdio>
#include <iostream>
using namespace std;

long long n,T,ans;
long long a[200010];
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(;;){
		long long cost=0,tot=0;
		for(int i=1;i<=n;i++){
			if(a[i]+cost<=T){
				cost+=a[i];
				tot++;
			}
		}
		if(tot==0)break;
		ans+=(T/cost)*tot;
		T%=cost;
	}
	cout<<ans;
}


#include <cstdio>

int n,ex,ey;
char str[200010];
int min(int a,int b){
    return a<b?a:b;
}
int abs(int x){
    return x<0?-x:x;
}
int main(){
    int h=1;
    scanf("%d%s%d%d",&n,str,&ex,&ey);
    if(abs(ex)+abs(ey)>n){
        puts("-1");
        return 0;
    }
    int ans=n+1;
    int cx=0,cy=0;
    for(int i=1;i<=n;i++){
        if(str[i-1]=='U')cy++;
        else if(str[i-1]=='D')cy--;
        else if(str[i-1]=='L')cx--;
        else if(str[i-1]=='R')cx++;
    }
    if(ex==cx&&ey==cy){
        puts("0");
        return 0;
    }
    int delta=(abs(ex-cx)+abs(ey-cy));
    if(delta%2){
        puts("-1");
        return 0;
    }
    delta>>=1;
    char ry=ey>cy?'D':(ey<cy?'U':'A'),rx=ex>cx?'L':(ex<cx?'R':'A');
    int count=0;
    for(int i=1;i<=n;i++){
        if(str[i-1]==ry||str[i-1]==rx){
            count++;
            if(count>delta){
                while(str[h-1]!=ry&&str[h-1]!=rx)h++;
                h++;
                count--;
            }
        }
        if(count==delta)ans=min(ans,i-h+1);
    }
    if(ans==n+1)puts("-1");
    else printf("%d",ans);
}


#include <cstdio>
#include <iostream>
using namespace std;

long long n,T,sum,ans;
long long a[200001];
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(;;){
		int cost=0,tot=0;
		for(int i=1;i<=n;i++){
			if(a[i]<=T){
				T-=a[i];
				cost+=a[i];
				tot++;
				ans++;
			}
		}
		if(cost==0)break;
		ans+=(T/cost)*tot;
		T%=cost;
	}
	printf("%d",ans);
}


#include <cstdio>
#include <iostream>
using namespace std;

long long n,T,sum,ans,mn=0x7f7f7f7f;
long long a[200001];
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
		if(mn>a[i])mn=a[i];
	}
	ans+=(T/sum)*n;
	T%=sum;
	for(;T>=mn;){
		int cost=0,tot=0;
		for(int i=1;i<=n;i++){
			if(a[i]<=T){
				T-=a[i];
				cost+=a[i];
				tot++;
				ans++;
			}
		}
		ans+=(T/cost)*tot;
		T%=cost;
	}
	printf("%d",ans);
}


#include <cstdio>
#include <iostream>
using namespace std;

long long n,T,ans;
long long a[200010];
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(;;){
		int cost=0,tot=0;
		for(int i=1;i<=n;i++){
			if(a[i]+cost<=T){
				cost+=a[i];
				tot++;
			}
		}
		if(cost==0)break;
		ans+=(T/cost)*tot;
		T%=cost;
	}
	cout<<ans;
}


#include <cstdio>
#include <iostream>
using namespace std;

long long n,T,sum,ans;
long long a[200001];
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	ans+=(T/sum)*n;
	T%=sum;
	for(;;){
		int cost=0,tot=0;
		for(int i=1;i<=n;i++){
			if(a[i]<=T){
				T-=a[i];
				cost+=a[i];
				tot++;
				ans++;
			}
		}
		if(cost==0)break;
		ans+=(T/cost)*tot;
		T%=cost;
	}
	printf("%d",ans);
}


#include <cstdio>
#include <iostream>
using namespace std;

long long n,T,sum,ans,mn=0x7f7f7f7f;
long long a[200001];
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
		if(mn>a[i])mn=a[i];
	}
	ans+=(T/sum)*n;
	T%=sum;
	for(;T>=mn;){
		for(int i=1;i<=n;i++){
			if(a[i]<=T){
				T-=a[i];
				ans++;
			}
		}
	}
	printf("%d",ans);
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

ll n;
ll a[N], vis[N], b[N], k;
map<ll,int> mp;
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	ll mi=1e9+10;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		mp[a[i]]++;
		sum += a[i];
		mi=min(mi,a[i]);
	}
	while(1)
	{
		ll l = 0, r = 1e18, mid;
		if ( sum <= t )
		{
			while ( l <= r )
			{
				mid = ( l + r ) >> 1;
				if ( mid * sum > t )
				{
					r = mid - 1;
				}
				else l = mid + 1;
			}
		}
		else r=0;

		//show2 ( "r", r );
		ans += r * n;
		t = t -  r * sum;
		//show2 ( "t", t );
		if ( t < mi ) return cout << ans << endl, 0;
		int flag=0;
		for ( int i = 1; i <= n; i++ )
		{
			if ( t >= a[i] &&!vis[i])
			{
				t -= a[i];
				ans++;
			}
			else if(!flag&&!vis[i])
			{
				vis[i]=1;
				k = i;
				flag=1;
			}
			if(t<mi) break;
		}
		//show2 ( "k", k );
		sum -= a[k] * mp[a[k]];
		n-=mp[a[k]];
		if(t<mi) break;
		//show2 ( "sum", sum )

	}

	cout << ans << endl;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

ll n;
ll a[N], vis[N], b[N], k;
map<ll,int> mp;
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	ll mi=1e9+10;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		mp[a[i]]++;
		sum += a[i];
		mi=min(mi,a[i]);
	}
	ll cnt=n;
	while(t>=mi)
	{
		ll r = t/sum;
		//show2 ( "r", r );
		ans += r * cnt;
		t %=sum;;
		//show2 ( "t", t );
		sum=0;
		cnt=0;
		for ( int i = 1; i <= n; i++ )
		{
			//show2(i,a[i])
			if ( t >= a[i] )
			{
				t -= a[i];
				ans++;
				sum+=a[i];
				cnt++;
			}

		}

	}

	cout << ans << endl;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

ll n;
ll a[N], vis[N], b[N], k;
map<ll,int> mp;
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	ll mi=1e9+10;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		mp[a[i]]++;
		sum += a[i];
		mi=min(mi,a[i]);
	}
	while(1)
	{
		ll r = t/sum;

		//show2 ( "r", r );
		ans += r * n;
		t = t -  r * sum;
		//show2 ( "t", t );
		if ( t < mi ) return cout << ans << endl, 0;
		int flag=0;
		for ( int i = 1; i <= n; i++ )
		{
			if ( t >= a[i] &&!vis[i])
			{
				t -= a[i];
				ans++;
			}
			else if(!flag&&!vis[i])
			{
				vis[i]=1;
				k = i;
				flag=1;
			}
			if(t<mi) break;
		}
		//show2 ( "k", k );
		sum -= a[k] * mp[a[k]];
		n-=mp[a[k]];
		if(t<mi) break;
		//show2 ( "sum", sum )

	}

	cout << ans << endl;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

int n;
ll a[N], vis[N], b[N], k;
int num[N];
map<ll,int> mp;
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	ll mi=1e9+10;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		mp[a[i]]++;
		sum += a[i];
		mi=min(mi,a[i]);
	}
	while(1)
	{
		ll l = 0, r = 1e18, mid;
		if ( sum <= t )
		{
			while ( l <= r )
			{
				mid = ( l + r ) >> 1;
				if ( mid * sum > t )
				{
					r = mid - 1;
				}
				else l = mid + 1;
			}
		}
		else r=0;

		//show2 ( "r", r );
		ans += r * n;
		t = t -  r * sum;
		//show2 ( "t", t );
		if ( t < mi ) return cout << ans << endl, 0;
		int flag=0;
		for ( int i = 1; i <= n; i++ )
		{
			if ( t >= a[i] &&!vis[i])
			{
				t -= a[i];
				ans++;
			}
			else if(!flag&&!vis[i])
			{
				vis[i]=1;
				k = i;
				flag=1;
			}
		}
		//show2 ( "k", k );
		sum -= a[k] * mp[a[k]];
		n-=mp[a[k]];
		if(t<mi) break;
		//show2 ( "sum", sum )

	}

	cout << ans << endl;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

int n;
int a[N], vis[N], b[N], k;
int num[N];
map<ll,int> mp;
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		mp[a[i]]++;
		sum += a[i];
	}
	while(1)
	{
		ll l = 0, r = 1e18, mid;
		if ( sum <= t )
		{
			while ( l <= r )
			{
				mid = ( l + r ) >> 1;
				if ( mid * sum > t )
				{
					r = mid - 1;
				}
				else l = mid + 1;
			}
		}
		else r=0;

		//show2 ( "r", r );
		ans += r * n;
		t = t -  r * sum;
		//show2 ( "t", t );
		if ( t == 0 ) return cout << ans << endl, 0;
		int flag=0;
		for ( int i = 1; i <= n; i++ )
		{
			if ( t >= a[i] &&!vis[i])
			{
				t -= a[i];
				ans++;
			}
			else if(!flag&&!vis[i])
			{
				vis[i]=1;
				k = i;
				flag=1;
			}
		}
		//show2 ( "k", k );
		sum -= a[k] * mp[a[k]];
		n-=mp[a[k]];
		if(sum<0) break;
		//show2 ( "sum", sum )

	}

	cout << ans << endl;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

ll n;
ll a[N], vis[N], b[N], k;
map<ll,ll> mp;
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	ll mi=1e9+10;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		mp[a[i]]++;
		sum += a[i];
		mi=min(mi,a[i]);
	}
	while(1)
	{
		ll l = 0, r = 1e18, mid;
		if ( sum <= t )
		{
			while ( l <= r )
			{
				mid = ( l + r ) >> 1;
				if ( mid * sum > t )
				{
					r = mid - 1;
				}
				else l = mid + 1;
			}
		}
		else r=0;

		//show2 ( "r", r );
		ans += r * n;
		t = t -  r * sum;
		//show2 ( "t", t );
		if ( t < mi ) return cout << ans << endl, 0;
		int flag=0;
		for ( int i = 1; i <= n; i++ )
		{
			if ( t >= a[i] &&!vis[i])
			{
				t -= a[i];
				ans++;
			}
			else if(!flag&&!vis[i])
			{
				vis[i]=1;
				k = i;
				flag=1;
			}
			if(t<mi) break;
		}
		//show2 ( "k", k );
                if(a[k]==mi)break;
		sum -= a[k] * mp[a[k]];
		n-=mp[a[k]];
		if(t<mi) break;
		//show2 ( "sum", sum )

	}

	cout << ans << endl;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#define fi first
#define se second
#define FOR(a) for(int i=0;i<a;i++)
#define show(a) cout<<a<<endl;
#define show2(a,b) cout<<a<<" !!! "<<b<<endl;
#define show3(a,b,c) cout<<a<<" !!! "<<b<<" !!! "<<c<<endl;
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, int> LP;
const ll inf = 0x3f3f3f3f;
const int N = 3e5 + 10;
const ll mod = 998244353;

int n;
int a[N], vis[N], b[N], k;
int num[N];
int main()
{
	ios::sync_with_stdio ( false );
	cin.tie ( 0 );
	ll t, ans = 0;
	cin >> n >> t;
	ll sum = 0;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> a[i];
		num[a[i]]++;
		sum += a[i];
	}
	while(1)
	{
		ll l = 0, r = 1e18, mid;
		if ( sum <= t )
		{
			while ( l <= r )
			{
				mid = ( l + r ) >> 1;
				if ( mid * sum > t )
				{
					r = mid - 1;
				}
				else l = mid + 1;
			}
		}
		else r=0;

		//show2 ( "r", r );
		ans += r * n;
		t = t -  r * sum;
		//show2 ( "t", t );
		if ( t == 0 ) return cout << ans << endl, 0;
		int flag=0;
		for ( int i = 1; i <= n; i++ )
		{
			if ( t >= a[i] &&!vis[i])
			{
				t -= a[i];
				ans++;
			}
			else if(!flag&&!vis[i])
			{
				vis[i]=1;
				k = i;
				flag=1;
			}
		}
		//show2 ( "k", k );
		sum -= a[k] * num[a[k]];
		n-=num[a[k]];
		if(sum<0) break;
		//show2 ( "sum", sum )

	}

	cout << ans << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        int i;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {

            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(1)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                r[i]=0;
                res+=mn;
            }
        }
        mn=o();
        if(mn==3e18)
        {
            break;
        }

    }
    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt v[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt ok=0;
        int i;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*mid;
            if(!v[i]&&g/a[i]!=mid)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*mid)>=0)
            {
                tt-=a[i]*mid;
                r[i]=max(r[i],mid);
            }
            else
            {
                ok++;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           st=mid+1;
       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
        {

         f+=1;
         v[i]=1;
        }
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(f<n)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                res+=mn;
                ok=1;
            }
            r[i]=0;
        }
        for(i=0;i<n;i++)
        {
            if(a[i]>t&&!v[i])
            {
                f++;
                v[i]=1;
            }
        }
        mn=o();
    }

    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt a[n];
    intt t;
    cin>>t;
    int i;
    intt f=0;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }
    intt st=0,en=1e18;
    intt maxx=0;
    intt r[n];
    memset(r,0,sizeof r);
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }
        if(tt>0)
        {
            for(i=0; i<n; i++)
            {
                if(tt-a[i]>=0)
                {
                    tt-=a[i];
                    c++;
                }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    int ok=1;
    intt res=0;
    while(ok)
    {
        intt mnn=3e18;
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]!=0)
            {
                t-=a[i]*mn;
                r[i]-=mn;
                res+=mn;
                if(r[i]!=0)
                mnn=min(mnn,r[i]);
                ok=1;
            }
        }
        mn=mnn;
        if(mn==3e18)
            break;
    }
    cout<<res;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt a[n];
    intt t;
    cin>>t;
    int i;
    intt f=0;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }
    intt st=0,en=11;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt aft=mid%n;
        intt c=0;
        intt ok=0;
        intt numd=0;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
            }
            else
            {
                ok++;
            }

        }
        while(aft--&&ok<=f)
        {
            numd=0;
            for(i=0;i<n;i++)
            {
                if(tt>=a[i])
                {
                    tt-=a[i];
                    c++;
                    numd++;
                }

            }
            if(numd==0)
            {
                break;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    cout<<maxx;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        int i;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(ok)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0)
            {
                t-=a[i]*mn;
                res+=mn;
                if(r[i]!=0)
                ok=1;
            }
            r[i]=0;
        }
        mn=o();
        if(mn==3e18)
        {
            break;
        }

    }

    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        int i;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {

            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(1)
    {
        intt mnn=4e18;
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                r[i]-=mn;
                res+=mn;
                if(r[i]!=0)
                mnn=min(mnn,r[i]);
                ok=1;
            }
        }
        mn=mnn;
        if(mn==4e18)
        {
            memset(r,0,sizeof r);
            mn=o();

        }
        if(mn==3e18)
        {
            break;
        }

    }
    cout<<res;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt a[n];
    intt t;
    cin>>t;
    int i;
    intt f=0;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }
    intt st=0,en=3e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
            }
            else
            {
                ok++;
            }
        }
        if(tt>0)
        {
            for(i=0; i<n; i++)
            {
                if(tt-a[i]>=0)
                {
                    tt-=a[i];
                    c++;
                }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    cout<<maxx;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        int i;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(ok)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                r[i]=0;
                res+=mn;
                ok=1;
            }
        }
        mn=o();
        if(mn==3e18)
        {
            break;
        }

    }
    for(i=0;i<n;i++)
    {
        if(t>a[i])
        {
            t-=a[i];
            res++;
        }
    }
    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt v[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        int i;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
        {

         f+=1;
         v[i]=1;
        }
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(1)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                res+=mn;
                ok=1;
            }

        }
        for(i=0;i<n;i++)
        {
            if(a[i]>t&&!v[i])
            {
                f++;
                v[i]=1;
            }
        }
        mn=o();
        if(f==n)
        {
            break;
        }

    }

    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt v[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt ok=f;
        int i;
        for(i=0; i<n; i++)
        {
            if(!v[i])
            {
            intt g=a[i]*mid;
            if(g/a[i]!=mid)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*mid)>=0)
            {
                tt-=a[i]*mid;
                r[i]=max(r[i],mid);
            }
            else
            {
                ok++;
            }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           st=mid+1;
       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
        {

         f+=1;
         v[i]=1;
        }
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(f<n&&mn>0)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                res+=mn;
                ok=1;
            }
            r[i]=0;
        }
        for(i=0;i<n;i++)
        {
            if(a[i]>t&&!v[i])
            {
                f++;
                v[i]=1;
            }
        }
        mn=o();
    }

    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt a[n];
    intt t;
    cin>>t;
    int i;
    intt f=0;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }
    intt st=0,en=12;
    intt maxx=0;
    intt r[n];
    memset(r,0,sizeof r);
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
                r[i]=max(r[i],f1);
            }
            else
            {
                ok++;
            }
        }
        if(tt>0)
        {
            for(i=0; i<n; i++)
            {
                if(tt-a[i]>=0)
                {
                    tt-=a[i];
                    c++;
                }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    intt mn=3e18;
    for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    int ok=1;
    intt res=0;
    while(ok)
    {
        intt mnn=3e18;
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]!=0)
            {
                t-=a[i]*mn;
                r[i]-=mn;
                res+=mn;
                if(r[i]!=0)
                mnn=min(mnn,r[i]);
                ok=1;
            }
        }
        mn=mnn;
        if(mn==3e18)
            break;
    }
    cout<<res;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt a[n];
    intt t;
    cin>>t;
    int i;
    intt f=0;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }
    intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        for(i=0; i<n; i++)
        {
            if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
            }
            else
            {
                ok++;
            }
        }
        if(tt>0)
        {
            for(i=0; i<n; i++)
            {
                if(tt-a[i]>=0)
                {
                    tt-=a[i];
                    c++;
                }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    cout<<maxx;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt v[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt ok=f;
        int i;
        for(i=0; i<n; i++)
        {
            if(!v[i])
            {
            intt g=a[i]*mid;
            if(g/a[i]!=mid)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*mid)>=0)
            {
                tt-=a[i]*mid;
                r[i]=max(r[i],mid);
            }
            else
            {
                ok++;
            }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           st=mid+1;
       }
    }
    intt mn=3e18;
    int i;
     for(i=0;i<n;i++)
    {
        if(r[i]!=0)
        mn=min(mn,r[i]);
    }
    return mn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
        {

         f+=1;
         v[i]=1;
        }
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(f<n)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(t-(a[i]*mn)>=0&&r[i]>=mn&&r[i]!=0)
            {
                t-=a[i]*mn;
                res+=mn;
                ok=1;
            }
            r[i]=0;
        }
        for(i=0;i<n;i++)
        {
            if(a[i]>t&&!v[i])
            {
                f++;
                v[i]=1;
            }
        }
        mn=o();
    }

    cout<<res;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt t;
    cin>>t;
    int i;
    multiset <intt > a;
    for(i=0; i<n; i++)
    {
        intt x;
        cin>>x;
        a.insert(x);

    }
    intt res=0;
    intt st=0,en=12;
    intt maxx=0;
    while(a.size())
    {
        maxx=0;
     st=0,en=1e18;
     intt cou=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt c=0;
        intt ok=0;
        set <intt> ::iterator it=a.begin();
        for(it; it!=a.end(); it++)
        {
            intt h=*it;
            intt g=h*mid;
            if(g/h!=mid)
            {
                ok=1e9;
                break;
            }
            else if(tt-(h*mid)>=0)
            {
                c+=mid;
                tt-=h*mid;
            }
            else
            {
                ok=1;
                break;
            }
        }

       if(ok)
       {
           en=mid-1;
       }
       else
       {
           if(c>maxx)
           {
               maxx=c;
               cou=t-tt;
           }
           st=mid+1;

       }
    }
    res+=maxx;
    t-=cou;

    a.erase(*--a.end());
    }
    cout<<res;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair

int main()
{

    intt n;
    cin>>n;
    intt a[n];
    intt t;
    cin>>t;
    int i;
    intt f=0;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
         f+=1;
    }
    intt st=0,en=1e18;
    intt maxx=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt f1=mid/n;
        intt c=0;
        intt ok=0;
        for(i=0; i<n; i++)
        {
            intt g=a[i]*f1;
            if(g/a[i]!=f1)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*f1)>=0)
            {
                c+=f1;
                tt-=a[i]*f1;
            }
            else
            {
                ok++;
            }
        }
        if(tt>0)
        {
            for(i=0; i<n; i++)
            {
                if(tt-a[i]>=0)
                {
                    tt-=a[i];
                    c++;
                }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }
       else
       {
           maxx=max(maxx,c);
           st=mid+1;

       }
    }
    cout<<maxx;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long intt;
#define pb push_back
#define sc second
#define fr first
#define mk make_pair
intt n;
intt a[200004];
intt t;
intt f;
intt r[200004];
intt v[200004];
intt o()
{
     intt st=0,en=1e18;
    intt maxx=0;
    intt mnn=0;
    while(st<=en)
    {
        intt tt=t;
        intt mid=(st+en)/2;
        intt ok=f;
        int i;
        for(i=0; i<n; i++)
        {
            if(!v[i])
            {
            intt g=a[i]*mid;
            if(g/a[i]!=mid)
            {
                ok=1e9;
                break;
            }
            else if(tt-(a[i]*mid)>=0)
            {
                tt-=a[i]*mid;
            }
            else
            {
                ok++;
            }
            }
        }

       if(ok>f)
       {
           en=mid-1;
       }

       else
       {
           mnn=max(mnn,mid);
           st=mid+1;
       }
    }

    return mnn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    cin>>t;
    int i;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>t)
        {

         f+=1;
         v[i]=1;
        }
    }

    intt mn=3e18;
    mn=o();

    int ok=1;
    intt res=0;

    while(f<n)
    {
        ok=0;
        for(i=0;i<n;i++)
        {
            if(mn>0)
            {

            if(t-(a[i]*mn)>=0)
            {
                t-=a[i]*mn;
                res+=mn;
                ok=1;
            }
            }
            else
            {
                if(t-a[i]>=0)
                {
                    t-=a[i];
                    res++;
                }
            }
        }
        for(i=0;i<n;i++)
        {
            if(a[i]>t&&!v[i])
            {
                f++;
                v[i]=1;
            }
        }
        mn=o();
    }

    cout<<res;
    return 0;
}