/*
    In the name of
        "ALLAH"
    And say "AL-HAMD-U-LILLAH"
*/

#include<bits/stdc++.h>
#define   ll   long long
#define   llu  unsigned long long
#define   _    printf("\n")
int      take() {
    int n;
    scanf("%d",&n);
    return n;

}
double  ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll     takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define  Int             take()
#define  Dnt             ttake()
#define  LL              takes()
#define  done            {return 0;}
#define  fr(i,x,n,a)     for(int i=x;i<=n;i+=a)
#define  FR(a,b,x)       for(int i=(a);i<=(b);i+=(x))
#define  rfr(i,x,n,a)    for(int i=x;i>=n;i--)
int      cas;
#define  print           printf("Case %d:",++cas)
#define  vi              vector<int>
#define  vl              vector<ll>
#define  pb              push_back
#define  pii             pair<int,int>
#define  vii             vector<pii>
#define  pll             pair<ll,ll>
#define  pil             pair<int,ll>
#define  pli             pair<ll,int>
#define  pipii           pair<int,pii>
#define  piipi           pair<pii,int>
#define  mk              make_pair
#define  fill(x,v)       memset(x,v,sizeof x)

using    namespace       std;

bool     approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define  STR             {struct info}
#define  dbg(x)          {cout<<"ekhane"<<x<<endl;}
#define  SS              second
#define  FF              first
#define  PQ              priority_queue
#define  great           greatest
#define  less            lesser
#define  mii             map<int,int>
#define  mil             map<int,ll>
#define  mll             map<ll,ll>
#define  msb             map<string,bool>
#define  V               vector
#define  M               100005
#define  pf              printf
#define  inf             INT_MAX
//////////////////////////////////////////

int main( ){
    int tc = 1 ;
    while( tc-- ){
        int n = Int , k = Int , arr[ n + 1 ] , ind = - 1;
        fr( i , 1 , n , 1 ){
            arr[ i ] = Int ;
            if( arr[ i ] == 1 ) ind = i ;
        }
        int ans = 0 ,rt = ( n - ind + 1 ) ;
      //  dbg( rt ) ;
            if( rt >= k ) ans = 1 , rt -= k ;
            else{
                int f = k - rt ;
                ans = 1 ;
                rt = 0 ;
                ind = ind - f ;
            }
            ans += ( rt / ( k - 1 ) ) ;
            int rem = 0 ;
            if( rt % ( k - 1 ) ) rem = rt % ( k - 1 ) ;
            rfr( i , ind - 1 , 1 , 1 ){
                rem++ ;
                if( rem == ( k - 1 ) ){
                    ans++ ; rem = 0 ;
                }
            }
            if( rem ) ans++ ;
        pf("%d",ans) ;
    }
    done ;
}


Measured memory_bytes: 640