#include <bits/stdc++.h>
using namespace std;
int _ = (cout << fixed << setprecision(9), cin.tie(0), ios::sync_with_stdio(0));
using Int = long long;
void solve(int N, string S, vector<int> A) {
    int k = 1e9;
    for (int i = 0; i < N; i++) {
        k = min(k, abs(A[i + 1] - A[i]));
    }
    vector<vector<int>> B(k, vector<int>(N + 1));
    for (int i = 0; i < N + 1; i++) {
        for (int j = 0; j < k; j++) {
            B[j][i] += A[i] / k;
        }
        for (int j = 0; j < A[i] % k; j++) {
            B[j][i] += 1;
        }
    }
    cout << k << '\n';
    for (int j = 0; j < k; j++) {
        for (int i = 0; i < N + 1; i++) {
            cout << B[j][i] << " \n"[i + 1 == N + 1];
        }
    }
}
int main() {
    int N; cin >> N;
    string S; cin >> S;
    vector<int> A(N + 1); for (auto &a : A) cin >> a;
    solve(N, S, A);
    return 0;
}

#include<iostream>
#include<cstring>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long LL;
const int N=2e5+10;
int a[N];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d",&a[i]);
	}
	a[++m]=0;
	a[++m]=n+1;
	sort(a+1,a+1+m);
	int minv=n;
	for(int i=1;i<=m-1;i++){
		if(a[i+1]>a[i]+1)
		minv=min(a[i+1]-a[i]-1,minv);
	}
	int cnt=0;
	for(int i=1;i<=m-1;i++){
		if(a[i+1]>a[i]+1)
		cnt+=(a[i+1]-a[i]-1+minv-1)/minv;
	}
	cout<<cnt;
}