stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
//By Don4ick 

//#define _GLIBCXX_DEBUG



#include <bits/stdc++.h>



typedef long long ll;

typedef long double ld;

typedef unsigned int ui;



#define forn(i, n) for (int i = 1; i <= n; i++)

#define pb push_back

#define all(x) x.begin(), x.end()

#define y1 qewr1234



const double PI = acos(-1.0);

const int DIR = 4;

const int X[] = {1, 0, -1, 0};

const int Y[] = {0, 1, 0, -1};



const int N = (int)1e5 + 228;



using namespace std;



int n, a[N];



int main()

{

	//ios_base::sync_with_stdio(false);

	//cin.tie();

	//cout.tie();		



	//freopen(".in", "r", stdin);

	//freopen(".out", "w", stdout);



	//~read

	scanf("%d", &n);

	forn(i, n)

		scanf("%d", &a[i]);

	//~solve

	sort(a + 1, a + n + 1);

	int ptr = 1;

	while(ptr < n && a[n - ptr] >= ptr + 1)

		ptr++;

	if (a[n - ptr + 1] == ptr && (ptr == n || a[n - ptr + 1] > a[n - ptr]))

	{

		cout << "Second" << endl;

		return 0;

	}

	if (((a[n - ptr + 1] - ptr) & 1))

	{

		cout << "First" << endl;

		return 0;

	}

	if (ptr < n)

	{

		int cnt = ptr - a[n - ptr];

		for (int i = n - ptr; i >= 1; i--)

		{

			cnt++;

			if (i == 1 || a[i] > a[i - 1])

				break;

		}

		if ((cnt & 1))

		{

			cout << "First" << endl;

			return 0;

		}

	}

	cout << "Second" << endl;



	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.266013733724852x):
#include <cstdio>

#include <algorithm>



#define Int register int



const int MAXN = 1e5;

int n, a[MAXN + 5];



inline void Work () {

	scanf ( "%d", &n );

	for ( Int i = 1; i <= n; ++ i ) scanf ( "%d", &a[i] );

	std :: sort ( a + 1, a + n + 1, []( const int x, const int y ) { return x > y; } );

	for ( Int i = 1; i <= n; ++ i ) {

		if ( i + 1 > a[i + 1] ) {

			int du = a[i] - i, dr = 0;

			for ( ; a[i + dr + 1] == i; ++ dr );

			puts ( du & 1 || dr & 1 ? "First" : "Second" );

			break;

		}

	}

}



int main () {

	Work ();

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n, a[100005];

int main ()

{

	scanf ("%d", &n);

	for (int i=1; i<=n; i++)

		scanf ("%d", &a[i]);

	sort (a + 1, a + n + 1);

	reverse (a + 1, a + n + 1);

	int x = 0;

	a[0] = a[1];

	while (a[x + 2] > x + 1 && x + 1 < n) x ++;

	int right=0,up=0,k=x;

	while (x<a[k] && k<=n)

		right++,k++;

	up=a[x+1]-x;

	right--;

	if (up%2==1 && right%2==1)

		printf ("Second\n");

	else 

		printf ("First\n");

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.239992831157363x):
#include <cstdio>

#include <algorithm>



#define Int register int



const int MAXN = 1e5;

int n, a[MAXN + 5];



inline void Work () {

	scanf ( "%d", &n );

	for ( Int i = 1; i <= n; ++ i ) scanf ( "%d", &a[i] );

	std :: sort ( a + 1, a + n + 1, []( const int x, const int y ) { return x > y; } );

	for ( Int i = 1; i <= n; ++ i ) {

		if ( i + 1 > a[i + 1] ) {

			int du = a[i] - i, dr = 0;

			for ( ; a[i + dr + 1] == i; ++ dr );

			puts ( du & 1 || dr & 1 ? "First" : "Second" );

			break;

		}

	}

}



int main () {

	Work ();

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

const int maxn=1e5+5,inf=1e9+10;

int a[maxn];

int main(){

    int i,n,p,q;

    scanf("%d",&n);

    for (i=0;i<n;i++) scanf("%d",&a[i]);

    sort(a,a+n);

    q=a[n-1];

    for (i=n-1;i;i--) a[i]=a[i]-a[i-1]+1;

    a[0]=inf;

    for (i=1;i<n-1;i++) if (a[i]==1&&(a[i+1]&1)){

        a[i]++; a[i+1]--;

    }

    p=n-1;

    while (q>a[p]) q-=a[p--];

    if ((a[p]&1)&&q==a[p]) puts("First");

    else puts((q&1)?"Second":"First");

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.280263265546243x):
#include <cstdio>

#include <algorithm>



#define Int register int



const int MAXN = 1e5;

int n, a[MAXN + 5];



inline void Work () {

	scanf ( "%d", &n );

	for ( Int i = 1; i <= n; ++ i ) scanf ( "%d", &a[i] );

	std :: sort ( a + 1, a + n + 1, []( const int x, const int y ) { return x > y; } );

	for ( Int i = 1; i <= n; ++ i ) {

		if ( i + 1 > a[i + 1] ) {

			int du = a[i] - i, dr = 0;

			for ( ; a[i + dr + 1] == i; ++ dr );

			puts ( du & 1 || dr & 1 ? "First" : "Second" );

			break;

		}

	}

}



int main () {

	Work ();

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

int n,a[100002];

int main()

{

	scanf("%d",&n);

    for(int i=1;i<=n;i++)

    	scanf("%d",&a[i]);

    sort(a+1,a+n+1,greater<int>());

    for(int i=1;i<=n;i++)

        if(i+1>a[i+1]&&a[i]>=i)

		{

            int j=0;

            while(a[j+i+1]==i) j++;

            if((a[i]-i)%2==0&&j%2==0) printf("Second");

            else printf("First");   

    		return 0;

        }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.241822022553441x):
#include <cstdio>

#include <algorithm>



#define Int register int



const int MAXN = 1e5;

int n, a[MAXN + 5];



inline void Work () {

	scanf ( "%d", &n );

	for ( Int i = 1; i <= n; ++ i ) scanf ( "%d", &a[i] );

	std :: sort ( a + 1, a + n + 1, []( const int x, const int y ) { return x > y; } );

	for ( Int i = 1; i <= n; ++ i ) {

		if ( i + 1 > a[i + 1] ) {

			int du = a[i] - i, dr = 0;

			for ( ; a[i + dr + 1] == i; ++ dr );

			puts ( du & 1 || dr & 1 ? "First" : "Second" );

			break;

		}

	}

}



int main () {

	Work ();

	return 0;

}
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS



#include <unordered_map>

#include <string>

#include <math.h>

#include <vector>

#include <iostream>

#include <algorithm>

#include <stack>

#include <queue>

#define MAXN 1005

#define INF 0x3f3f3f3f

#define MOD 1000000007

#define PI acos(-1)

typedef long long ll;

typedef unsigned long long ull;



using namespace std;



int n, a[100005];



int cmp(int a, int b) {

	return a > b;

}



int main() {

	scanf("%d", &n);

	for (int i = 1; i <= n; ++i)

		scanf("%d", &a[i]);

	sort(a + 1, a + n + 1,cmp);

	int i = 1, j;

	while (a[i] >= i) ++i;

	--i;

	j = i + 1;

	while (a[j] == i) ++j;

	--j;

	if ((a[i] - i) % 2 || (j - i) % 2)

		cout << "First" << endl;

	else

		cout << "Second" << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.265886719901151x):
#include <cstdio>

#include <algorithm>



#define Int register int



const int MAXN = 1e5;

int n, a[MAXN + 5];



inline void Work () {

	scanf ( "%d", &n );

	for ( Int i = 1; i <= n; ++ i ) scanf ( "%d", &a[i] );

	std :: sort ( a + 1, a + n + 1, []( const int x, const int y ) { return x > y; } );

	for ( Int i = 1; i <= n; ++ i ) {

		if ( i + 1 > a[i + 1] ) {

			int du = a[i] - i, dr = 0;

			for ( ; a[i + dr + 1] == i; ++ dr );

			puts ( du & 1 || dr & 1 ? "First" : "Second" );

			break;

		}

	}

}



int main () {

	Work ();

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<stdio.h>

#include<cstring>

#include<vector>

#include<algorithm>

using namespace std;

const int max_n = 1e6 + 5;

bool cmp(int a,int b){return a > b;}



int main(){

    int n,a[max_n];

    memset(a,0,sizeof(a));

    scanf("%d",&n);

    for(int i =  1; i <= n; i++){

        scanf("%d",&a[i]);

    }

    sort(a+1 , a+ n+1,cmp);

    for(int x = 1; x <= n; x++){

        if(a[x + 1] < x + 1 && a[x] >= x){

            int j = 0;

            while(a[j + x + 1] == x) j++;//距离右边界距离

            if((a[x] -x) %2 == 0 && j % 2 == 0)printf("Second\n");

            else printf("First\n");

            break;

        }

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.1673406675992055x):
#include <cstdio>

#include <algorithm>

#include <iostream>

#include <cstring>

#include <vector>

using namespace std;

const int N = 4e5;

int a[N + 3];

int d[N + 3];

int dp[N + 3][10];

vector<int> b;

int n;

bool cmp(int x, int y) { 

    return x > y; 

}

int main() {

    scanf("%d", &n);

    for (int i = 1; i <= n; i++)

        scanf("%d", &a[i]);

    sort(a + 1, a + n + 1, cmp);

    int pos = 0;

    for (int i = 1; i <= n; i++) {

        if (a[i] >= i && a[i + 1] <= i) {

            pos = i;

            break;

        }

    }

    int len1 = 0;

    for (int i = pos + 1; i <= n; i++) {

        if (a[i] > pos - 1)

            len1++;

    }

    int len2 = a[pos] - pos;

    if ((!(len1 & 1)) && (!(len2 & 1)))

        printf("Second");

    else

        printf("First");

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<stdio.h>

#include<cstring>

#include<vector>

#include<algorithm>

using namespace std;

const int max_n = 1e6 + 5;

bool cmp(int a,int b){return a > b;}



int main(){

    int n,a[max_n];

    memset(a,0,sizeof(a));

    scanf("%d",&n);

    for(int i =  1; i <= n; i++){

        scanf("%d",&a[i]);

    }

    sort(a+1 , a+ n+1,cmp);

    for(int x = 1; x <= n; x++){

        if(a[x + 1] < x + 1 && a[x] >= x){

            int j = 0;

            while(a[j + x + 1] == x) j++;//距离右边界距离

            if((a[x] -x) %2 == 0 && j % 2 == 0)printf("Second\n");

            else printf("First\n");

            break;

        }

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2121103067974905x):
#include<bits/stdc++.h>

#define int long long

using namespace std;

const int N=1e5+5;

int n,a[N],k1,k2;

bool cmp(int x,int y){

	return x>y;

}

signed main(){

	scanf("%lld",&n);

	for(int i=1;i<=n;i++)

		scanf("%lld",&a[i]);

	sort(a+1,a+1+n,cmp);

	for(int i=1;i<=n;i++)

		if(i+1>a[i+1]){

			k1=a[i]-i,k2=0;

			for(int j=i+1;j<=n;j++)

				if(a[j]==i) k2++;

			break;

		}

	if(k1&1||k2&1) puts("First");

	else puts("Second");

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;



int main()

{

	int n = 0;

	int s = 0;

	

	cin >> n;

	

	vector <int> b;

	

	for (int i = 0; i < n - 1; i++) {

		cin >> s;

		b.push_back(s);

	}

	int result = b[0];

	for (int i = 1; i < n - 1; i++) {

		result += min(b[i - 1], b[i]);

	}

	result += b[n - 2];

	cout << result;

}

// Faster C++ solution for the same problem (measured speedup: 5.301378491771087x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    int n;

    scanf("%d",&n);

    for(int i=1;i<n;i++) scanf("%d",&a[i]);

    int ans = a[1]+a[n-1];

    for(int i=1;i<n-1;i++)

        ans+= min(a[i],a[i+1]);

    printf("%d",ans);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

using namespace std;



int main() {

	int n;

	cin >> n;



	vector<int> b(n - 1), v(n);



	for (auto &t : b)cin >> t;



	v[0] = b[0];

	v[1] = b[0];

	

	for (int i = 2; i < n - 1; ++i) {

		if (v[i - 1] > b[i - 1]) {

			v[i - 1] = b[i - 1];

		}

			v[i] = b[i - 1];

	}



	if (v[n - 2] < b[n - 2]) {

		v[n - 1] = b[n - 2];

	}

	else {

		v[n - 1] = b[n - 2];

		v[n - 2] = b[n - 2];

	}



	int sum = 0;



	for (auto t : v) sum += t;



	cout << sum;



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.261221867766617x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int maxd = 1e5+10;

int a[maxd];

int main()

{

    // freopen("a.in","r",stdin);

    // freopen("k.out","w",stdout);

    int n;

    scanf("%d",&n);

    for(int i=1;i<n;i++) scanf("%d",&a[i]);

    int ans = a[1]+a[n-1];

    for(int i=1;i<n-1;i++)

        ans+= min(a[i],a[i+1]);

    printf("%d",ans);

    return 0;

}
// Slower C++ solution:
#include <cstdio>



const int MAXN = 400;

const int MOD = 998244353;



int pow_mod(int b, int p) {

	int ret = 1;

	for(int i=p;i;i>>=1,b=1LL*b*b%MOD)

		if( i & 1 ) ret = 1LL*ret*b%MOD;

	return ret;

}



int fct[MAXN + 5], ifct[MAXN + 5];

void init() {

	fct[0] = 1;

	for(int i=1;i<=MAXN;i++)

		fct[i] = 1LL*fct[i-1]*i%MOD;

	ifct[MAXN] = pow_mod(fct[MAXN], MOD-2);

	for(int i=MAXN-1;i>=0;i--)

		ifct[i] = 1LL*ifct[i+1]*(i+1)%MOD;

}



int A[MAXN + 5], B[MAXN + 5], SA, SB;



int f[2][2][MAXN + 5][MAXN + 5];



int main() {

	init();

	int N; scanf("%d", &N);

	for(int i=1;i<=N;i++)

		scanf("%d%d", &A[i], &B[i]), B[i];

	f[0][0][0][0] = 1;

	for(int i=1;i<=N;i++) {

		for(int j=0;j<=SA;j++)

			for(int k=0;k<=SB;k++)

				f[1][0][j][k] = f[0][0][j][k], f[1][1][j][k] = f[0][1][j][k];

		for(int j=0;j<=SA;j++)

			for(int k=0;k<=SB;k++) {

				int t = 1;

				for(int p=0;p<=B[i];p++,t=1LL*t*A[i]%MOD) {

					if( p == B[i] ) {

						int d = (MOD - 1LL*t*ifct[p-1]%MOD*f[1][0][j][k]%MOD)%MOD;

						f[0][1][j+A[i]][k+p] = (f[0][1][j+A[i]][k+p] + d)%MOD;

					}

					else {

						int d = (MOD - 1LL*t*ifct[p]%MOD*f[1][0][j][k]%MOD)%MOD;

						f[0][0][j+A[i]][k+p] = (f[0][0][j+A[i]][k+p] + d)%MOD;

						d = (MOD - 1LL*t*ifct[p]%MOD*f[1][1][j][k]%MOD)%MOD;

						f[0][1][j+A[i]][k+p] = (f[0][1][j+A[i]][k+p] + d)%MOD;

					}

				}

			}

		SA += A[i], SB += B[i];

	}

	int ans = 0;

	for(int i=1;i<=SA;i++)

		for(int j=1;j<=SB;j++) {

			int d = 1LL*f[0][1][i][j]*fct[j-1]%MOD*j%MOD*pow_mod(i,MOD-1-j-1)%MOD;

			ans = (ans + d)%MOD;

		}

	printf("%lld\n", 1LL*SA*(MOD - ans)%MOD);

}

// Faster C++ solution for the same problem (measured speedup: 1.1155377120220007x):
#include<cstdio>

using namespace std;



const int maxn = 405, mod = 998244353;

typedef long long ll;

int inv[maxn];



int fpow(int x, int k)

{

    int res = 1;

    while (k) {

        if (k & 1) res = (ll)res * x % mod;

        k >>= 1; x = (ll)x * x % mod;

    }

    return res;

}



int A[maxn], B[maxn], SA, SB, f[2][maxn][maxn];



int main()

{

    inv[1] = 1;

    for (int i = 2; i < maxn; i++) inv[i] = mod - 1LL * inv[mod % i] * (mod / i) % mod;

    int n;

    scanf("%d", &n);

    for (int i = 0; i < n; i++) scanf("%d%d", &A[i], &B[i]), SA += A[i], SB += B[i];

    f[0][0][0] = mod - 1;

    for (int i = 0; i < n; i++) {

        for (int j = 0; j <= SA; j++)

            for (int k = 0; k <= SB; k++)

                f[1][j][k] = f[0][j][k];

        int p = 1;

        for (int l = 0; l < B[i]; l++, p = (ll)p * A[i] % mod * inv[l] % mod)

            for (int j = A[i]; j <= SA; j++)

                for (int k = l; k <= SB; k++)

                    f[0][j][k] = (f[0][j][k] + (ll)(mod - f[1][j - A[i]][k - l]) * p) % mod;

    }

    int ans = 0;

    for (int j = 1; j <= SA; j++) {

        int p = 1, q = (ll)SA * inv[j] % mod;

        for (int k = 0; k <= SB; k++, p = (ll)p * k % mod * inv[j] % mod) ans = (ans + (ll)f[0][j][k] * p % mod * q) % mod;

    }

    printf("%d\n", ans);

	

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.8263287803503117x):
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 10;



int a[N];



int main(){

	int n, k;

	scanf("%d %d",&n,&k);

	for (int i = 1; i <= n; i++) scanf("%d",&a[i]);

	printf("%d\n", (n - 2) / (k - 1) + 1);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.8255714091742288x):
#include<bits/stdc++.h>

using namespace std;

int main()

{



      int n,k;

      scanf("%d %d",&n,&k);

      int arr[n+5];

      int i;

      for( i=0; i<n; i++)

      {

        scanf("%d",&arr[i]);

      }

       int d = k-1;

      int o=0;

      for(i=d; i<n; i=i+d)

      {

         o++;

         if(i==n-1)

         {

          printf("%d\n",o);

          return 0;

         }

      }

       printf("%d\n",o+1);

      return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.7814498954501854x):
#include <bits/stdc++.h>



using namespace std;



typedef long long               ll;

typedef unsigned long long      ull;

typedef vector<int>             vi;

typedef vector<ll>              vll;

typedef pair<ll,ll>             pairll;

typedef map<ll,ll>              mapll ;

typedef map<char,ll>            mapch;

typedef map<string,ll>          mapstr;



#define si(a) scanf("%d", &a)

#define sll(a) scanf("%lld",&a)

#define sii(a,b) scanf("%d %d", &a,&b)

#define pb push_back

#define mp make_pair

#define ff first

#define ss second

#define pt(a) printf("%d",a)

#define pll(a) printf("%lld",a)

#define ps printf(" ")

#define nln printf("\n")

#define pi acos(-1)

#define spc " "

#define nl "\n"

#define rep(i,W) for(int i = 0; i < W; i++)

#define rep1(i,W) for(int i = 1; i <= W; i++)



ll N, K;

vector<ll> arr;



void input(){

    cin >> N >> K;

    rep(i,N)

    {

        ll in;

        sll(in); arr.pb(in);

    }

}



void solve(){

    ll x = N-1;

    ll y = ceil((double)x/(K-1));

    cout << y << "\n";

}



int main(){

    input();

    solve();

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.8187898940929759x):
#include<bits/stdc++.h>

using namespace std;



int n,k,a,p;



int main(){

	scanf("%d%d%d",&n,&k,&a);

	while(a!=1)scanf("%d",&a),p++;

	printf("%.0f\n",ceil((float)(p)/(k-1))+ceil((float)(n-ceil((float)(p)/(k-1))*(k-1)-1)/(k-1)));

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.8037173220881666x):
#include<bits/stdc++.h>

using namespace std;

int n,k;

int a[100100];

int main(){

	//freopen("input.txt","r",stdin);

	//freopen("output.txt","w",stdout);

	cin>>n>>k;

	for(int i=1;i<=n;i++)

		cin>>a[i];

	int res=0;

	for(int i=1;i<=n;i+=(k-1)){

		res++;

		if(i+(k-1)>=n)

			break;

	}

	cout<<res<<endl;

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.8071189737280036x):
#include <bits/stdc++.h>



using namespace std;



int main() {

  int n, k; cin >> n >> k;

  n--, k--; cout << (n + k - 1) / k << '\n';

  //cout << ans << '\n';

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

using namespace std;

int a[100005],f[100005];

int main()

  {int n,k;

    cin >> n >> k;

   int i,Min = 0x7fffffff,num = 0;

   memset(a,0,sizeof(a));

   memset(f,0,sizeof(f));

   for(i = 1;i <= n;i ++)

          {cin >>a[i];Min = min(a[i],Min);

          }

   for(i = 1;i <= n;i ++)

   {  if(a[i] != Min)f[num]++;

      else num++;

   }

   int cnt = 0;

   if(a[n] == Min)num--;

   for(i = 0;i <= num;i ++)

   {

    while(f[i] > 0)

        {   cnt ++;

            f[i] -= k-1;

        }

    if(f[i] < 0)

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

   }

   cout<<cnt<<endl;

  }


// Faster C++ solution for the same problem (measured speedup: 1.8052521601942426x):
#include<bits/stdc++.h>

using namespace std;

int a[500002];

int main()

{

    int n,i,j,k,l,res=0;

    cin>>n>>k;

    for(i=0;i<n;i++)

    {

        cin>>a[i];

    }

    i=0;

    while(1)

    {

        i=i+k;

        res++;

        if(i>=n)break;

        else i--;

    }

    cout<<res<<'\n';

    return 0;

}