#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<ll, ll>;
using tp = tuple<ll, ll, ll>;

template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;

#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rep2(i, m, n) for(ll i = (ll)(n)-1; i >= (ll)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)

constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
static const ld pi = 3.141592653589793L;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

//グラフ関連
struct Edge {
    int to, rev;
    ll cap;
    Edge(int _to, ll _cap, int _rev) : to(_to), cap(_cap), rev(_rev) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, int from, int to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (int)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (int)G[from].size() - 1));
}

void solve() {
    ll n;
    string s;
    cin >> n >> s;
    vec<ll> a(n + 1);
    REP(i, n + 1) {
        cin >> a[i];
    }

    ll d = INF;
    REP(i, n) {
        chmin(d, abs(a[i + 1] - a[i]));
    }

    vvec<ll> b(d, vec<ll>(n + 1, 1));

    REP(i, d) {
        REP(j, n + 1) {
            b[i][j] = a[j] / d;
            if(i < a[j] % d)
                b[i][j]++;
        }
    }

    cout << d << en;
    for(auto i : b) {
        for(auto j : i)
            cout << j << " ";
        cout << en;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    // ll t;
    // cin >> t;
    // REP(i, t - 1) {
    //     solve();
    // }

    solve();

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,j,n) for (int i=j; i <=(int)(n); i++)

int a[110];
int b[110];

int main() {
	int n,k,m,mi;
	string s;

	cin >> n >> s;
	rep(i,n+1)cin >> a[i];
	rep(i,n) b[i]=a[i+1]-a[i];
	k=10010;
	rep(i,n){
		if(b[i]>0) k=min(k,b[i]);
		else k=min(k,-b[i]);
	}
	cout << k << endl;
	rep(j,k) {
		rep(i,n+1) cout << (int)((a[i]+j)/k)<<" ";
		cout << endl;
	}
	return 0;
}