#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define F first
#define S second
ll MOD = 1000000007;
 
ll power(ll base, ll n){
	if (n == 0) return 1;
	if (n == 1) return base;
	ll halfn = power(base, n/2);
	if (n % 2 == 0) return (halfn * halfn) % MOD;
	return (((halfn * halfn) % MOD) * base) % MOD;
}
 
ll inverse(ll n){
	return power(n, MOD-2);
}
 
ll add(ll a, ll b){
	return (a+b) % MOD;
}

ll mul(ll a, ll b){
	return (a*b) % MOD;
}

ll gcd(ll a, ll b){
	if (a == 0) return b;
	if (a == 1) return 1;
	return gcd(b % a, a);
}

int main(){
	ios::sync_with_stdio(false);
	int n; cin >> n;
	string s; cin >> s;
	vi a(n+1); FOR(i, 0, n+1) cin >> a[i];
	int mini = abs(a[1] - a[0]);
	FOR(i, 1, n+1){
		mini = min(mini, abs(a[i]-a[i-1]));
	}
	cout << mini << '\n';
	FOR(i, 0, mini){
		FOR(j, 0, n+1){
			if (a[j] % mini > i) cout << a[j]/mini + 1 << " ";
			else cout << a[j]/mini << " ";
		}
		cout << '\n';
	}
	return 0;
}







// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,mmx,avx,avx2")
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
//All indexing is 0-based
template<class key, class cmp = std::less<key>>
using oset = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
//methods: find_by_order(k); & order_of_key(k);
//To make it an ordered_multiset, use pairs of (value, time_of_insertion)
//to distinguish values which are similar 
template<class key, class value, class cmp = std::less<key>>
using omap = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
#define lld long double
#define w(x) ll x;cin>>x;while(x--)
#define all(x) x.begin(), x.end()
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define gcd(a,b)	__gcd(a,b)
#define lcm(a,b)	__detail::__lcm(a,b)
#define goog(tno) cout << "Case #" << tno <<": "
#define PRESS_F_TO_PAY_RESPECT ios_base::sync_with_stdio(false), cin.tie(nullptr)

void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");} 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define bug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define bug(x...)
#endif

ll dx[]= {-1,-1,-1,0,0,1,1,1};
ll dy[]= {-1,0,1,-1,1,-1,0,1};
const lld pi=3.1415926535897932384626433832795;
const ll INF=1e18;
const ll mod=1000000007;
const ll maxn=1e5+5;


template<typename T>
void printv(const vector<T>& v) { for(auto i:v) cout<<i<<' '; cout<<'\n'; }
template<typename T>
void printv(const vector<pair<T, T>>& v) { for(auto p:v) cout<<"("<<p.first<<","<<p.second<<"),"; cout<<'\n'; }


int main(){
	PRESS_F_TO_PAY_RESPECT;
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ll pos,neg;	cin>>pos>>neg;
	vector<ll> p,n;
	for(ll i=0;i<neg;i++){
		// cout<<-1*pos<<" ";
		n.push_back(-1*pos);
	}
	for(ll i=0;i<pos;i++){
		// cout<<neg<<" ";
		p.push_back(neg);
	}
	vector<ll> v;
	ll cnt=0;
	for(ll i=0;i<p.size();i++){
		v.push_back(p[i]+cnt);
		cnt++;
	}
	cnt=0;
	for(ll i=0;i<n.size();i++){
		v.push_back(n[i]-cnt);
		cnt++;
	}
	bug(v);
	ll s=accumulate(all(v),0LL);
	bug(s);
	if(s>0)	v.back()-=s;
	else v.front()-=s;
	bug(v);
	s=accumulate(all(v),0LL);
	bug(s);
	printv(v);
	return 0;
}