#include <bits/stdc++.h>

#define debug(x) cerr << #x << " = " << x << endl
#define int long long

using namespace std;
typedef long long LL;

const int MAXN = 2E5 + 5;
const int MOD = 1E9 + 7;
int n, m, a[MAXN];
vector<int> delta;

template <class T>
void read(T& x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
    while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

template <class T, class... Args>
void read(T& x, Args&... args) {
    read(x), read(args...);
}

template <class T>
void write(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

signed main() {
    // freopen("1.in", "r", stdin);
    read(n, m);
    for (int i = 1; i <= m; i++) read(a[i]);
    sort(a + 1, a + m + 1);
    if (!m) {
        cout << 1;
        return 0;
    }
    a[0] = 0, a[m + 1] = n + 1;
    int ans = 0;
    for (int i = 1; i <= m + 1; i++)
        if (a[i] - a[i - 1] - 1 > 0) delta.push_back(a[i] - a[i - 1] - 1);
    // for (auto& d : delta) cout << d << endl;
    if (delta.size()) {
        int cur = 0;
        int mi = delta[0];
        for (int i = 1; i < delta.size(); i++) mi = min(mi, delta[i]);
        for (auto& now : delta) cur += ceil(1.0 * now / mi);
        ans = cur;
    }
    cout << ans;
    return 0;
}
#include <bits/stdc++.h>

using namespace std;

#define PI 3.14159265358979323846264338327950L

string randStr(){
    string ret;
    int rnd=rand()%9;
    if(rnd==8){
        ret='.';
    }else{
        ret = rnd+'A';
    }

    return ret;
}

int main(void){

    int N,M;

    cin>>N>>M;
    vector<string> S(M);
    vector<string> ans(N);

    for(int i=0;i<M;i++){
        cin>>S[i];
    }

    int index=0;
    for(int i=0;i<N;i++){
        // if(ans[index].size()<N){
        //     ans[index].append(S[i]);
        // }else{
        //     index++;
        // }
        ans[i%N].append(S[i]);
    }

    for(int i=0;i<N;i++){
        if(ans[i].size()>N){
            ans[i] = ans[i].substr(0,N);
        }else{
            int tmp = N-ans[i].size();
            for(int j=0;j<tmp;j++){
                ans[i].append(randStr() );
            }
        }
    }

    for(int i=0;i<N;i++){
        cout<<ans[i]<<endl;
    }







    return 0;
}

