Language: Java

#include <bits/stdc++.h>
using namespace::std;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
template <class T1, class T2> ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}





void _main() {
        int n, k; cin >> n >> k;
        vector<int> a(n); cin >> a;
        int m = *min_element(all(a));
        int ans = n;
        for (int i = 0; i < n; i++) {
                if (a[i] == m) {
                        int cnt = 0;
                        for (auto j: {n - i}) {
                                cnt += (n - k + k - 2) / (k - 1);
                        }
                        ans = min(ans, cnt + 1);
                }
        }

        cout << ans;
}




signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:4: error: illegal character: '#'
#define all(x) (x).begin(), (x).end()
^
Main.java:4: error: class, interface, enum, or record expected
#define all(x) (x).begin(), (x).end()
        ^
Main.java:5: error: illegal character: '#'
#define sz(x) (int)(x).size()
^
Main.java:8: error: class, interface, enum, or record expected
typedef array<int, 3> tri;
^
Main.java:9: error: class, interface, enum, or record expected
typedef long double ld;
^
Main.java:11: error: class, interface, enum, or record expected
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
^
Main.java:11: error: '{' expected
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
                 ^
Main.java:11: error: class, interface, enum, or record expected
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
                                                         ^
Main.java:11: error: class, interface, enum, or record expected
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
                                                                                        ^
Main.java:11: error: class, interface, enum, or record expected
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
                                                                                                 ^
Main.java:12: error: '{' expected
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
                 ^
Main.java:12: error: class, interface, enum, or record expected
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
                                                               ^
Main.java:12: error: class, interface, enum, or record expected
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
                                                                                                           ^
Main.java:12: error: class, interface, enum, or record expected
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
                                                                                                                    ^
Main.java:13: error: '{' expected
template <class T1, class T2> ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
                  ^
Main.java:13: error: '{' expected
template <class T1, class T2> ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
                            ^
Main.java:13: error: class, interface, enum, or record expected
template <class T1, class T2> ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
                                                                        ^
Main.java:13: error: class, interface, enum, or record expected
template <class T1, class T2> ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
                                                                                                                                          ^
Main.java:20: error: class, interface, enum, or record expected
        int n, k; cin >> n >> k;
                  ^
Main.java:21: error: unnamed classes are a preview feature and are disabled by default.
        vector<int> a(n); cin >> a;
        ^
  (use --enable-preview to enable unnamed classes)
Main.java:21: error: <identifier> expected
        vector<int> a(n); cin >> a;
                       ^
Main.java:21: error: class, interface, enum, or record expected
        vector<int> a(n); cin >> a;
                          ^
Main.java:22: error: illegal start of expression
        int m = *min_element(all(a));
                ^
Main.java:24: error: class, interface, enum, or record expected
        for (int i = 0; i < n; i++) {
        ^
Main.java:24: error: class, interface, enum, or record expected
        for (int i = 0; i < n; i++) {
                        ^
Main.java:24: error: class, interface, enum, or record expected
        for (int i = 0; i < n; i++) {
                               ^
Main.java:27: error: class, interface, enum, or record expected
                        for (auto j: {n - i}) {
                        ^
Main.java:29: error: class, interface, enum, or record expected
                        }
                        ^
Main.java:31: error: class, interface, enum, or record expected
                }
                ^
Main.java:35: error: class, interface, enum, or record expected
}
^
Main.java:41: error: class, interface, enum, or record expected
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                      ^
Main.java:41: error: class, interface, enum, or record expected
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                                  ^
Main.java:45: error: class, interface, enum, or record expected
        while (_t--) _main();
        ^
Main.java:46: error: class, interface, enum, or record expected
        return 0;
        ^
Main.java:47: error: class, interface, enum, or record expected
}
^
37 errors