#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define ud unsigned int
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x3f
#define MAX_INF_VAL 0x3f3f3f3f
#define MAX_INF_VAL_LL 0x3f3f3f3f3f3f3f3f
//#define pi 3.141592653589
#define eps 1e-9
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)
//#define p 2173412051LL
//#define sz 2

using namespace std;

template< typename T > void read( T &x ) {
	x = 0;
	char ch = getchar();
	ll f = 1;
	while( !isdigit( ch ) ) {
		if( ch == '-' )
		f *= -1;
		ch = getchar();
	}
	while( isdigit( ch ) ) {
		x = x * 10 + ch - 48;
		ch = getchar();
	}
	x *= f;
}

struct custom_hash {
    static uint64_t splitmix64( uint64_t x ) {
        x += 0x9e3779b97f4a7c15;
        x = ( x ^ ( x >> 30 ) ) * 0xbf58476d1ce4e5b9;
        x = ( x ^ ( x >> 27 ) ) * 0x94d049bb133111eb;
        return x ^ ( x >> 31 );
    }

    size_t operator() ( uint64_t x ) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64( x + FIXED_RANDOM );
    }
};

bool vis[ 210 ];

int main() {
	ios::sync_with_stdio( false );
	cin.tie( 0 ), cout.tie( 0 );
	int t;
	ll n;
	cin >> t >> n;
	for( int i = 1; i <= 100; ++i ) {
		int tmp = 0;
		while( ( tmp + 1 ) * 100 <= ( 100 + t ) * i )
			++tmp;
		vis[ tmp ] = true;
	}
	vector< ll > fk;
	for( int i = 1; i <= 100 + t; ++i )
		if( !vis[ i ] )
			fk.push_back( i );
	ll m = fk.size();
	ll p = n / m, q = n % m;
	if( q == 0 ) {
		--p;
		q = fk.size();
	}
	cout << p * ( 100 + t ) + fk[ q - 1 ];
	return 0;
}
#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;
}
