#include<bits/stdc++.h>
using namespace std;
    #define author          "Sihare0riginals"
    #define ss              string 
    #define lli             long long int
    #define ld              long double
    #define f               first
    #define s               second
    #define all(v)          v.begin(),v.end()
    #define I(a,i)          memset(a,i,sizeof(a));
    #define pb              push_back
    #define mp              make_pair
    #define L(i,start,end)  for(lli i=start;i<=end;i++)
    #define R(i,start,end)  for(lli i=start;i>=end;i--)
    #define ip(n)           cin>>n;lli ip[n+1];L(i,1,n)cin>>ip[i];
const lli LINF = 1e18,mod=1e9+7;
void Bl0ck_M0mb0();
 
 
signed main()
{
    Bl0ck_M0mb0();
    lli t=1;
    //cin>>t;
    while(t--){
       lli n,m;
       cin>>n>>m;
       lli ip[n+1],ip1[m+1];
       set<lli> X;
       L(i,1,n)
       {
        cin>>ip[i];
        X.insert(ip[i]);
       } 
       L(i,1,m)
       {
        cin>>ip1[i];
        if(X.find(ip1[i])!=X.end())
        X.erase(ip1[i]);
    else
        X.insert(ip1[i]);
       }
       for(auto it:X)
        cout<<it<<" ";
    cout<<endl;
    }
    return 0;
}





























void Bl0ck_M0mb0(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("ip.txt","r",stdin);
    freopen("op.txt","w",stdout);
    #endif
}
/*
#define dbg1D(i,start,end,arr) for(lli i=start;i<=end;i++) cout<<i<<"th : "<<arr[i]<<endl;
#define dbg2D(i,j,s1,e1,s2,e2,arr) for(lli i=s1;i<=e1;i++){cout<<i<<"th :";for(lli j=s2;j<=e2;j++)cout<<arr[i][j]<<" ";cout<<endl;}
#define M map<lli,lli> \n #define sz(s) s.size()-1
#define P pair<lli,lli> 
#define V vector<lli>
lli dx[4]={-1, 0, 0, +1};
lli dy[4]={0, -1, +1, 0};
lli power(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m;
    lli t=power(a,b/2,m); t=(t*t)%m; if(b&1) t=(t*a)%m; return t;}
lli modInverse(lli a, lli m) { return power(a, m-2, m); } */
#include <bits/stdc++.h>
#define pi pair<int, int>
#define pb push_back
#define l first
#define r second

using namespace std;

const int maxn = 2e5 + 1, mod = 1e9 + 7;

int n;
string s;
bool subzero[101];
vector<int> v[10001];
int a[101], b[101], vl[101], c[101];
int cc = 0;

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> s;
    for (int i = 0; i <= n; i++)
        cin >> a[i];
    for (int i = 0; i <= n; i++) {
        b[i] = a[i] - (!i ? 0 : a[i - 1]);
        if (b[i] < 0) subzero[i] = 1;
    }
    int mn = 1e9;
    for (int i = 1; i <= n; i++)
        mn = min(mn, abs(b[i]));
    cout << mn << '\n';
    for (int i = 0; i <= n; i++) {
        vl[i] = b[i] / mn;
        c[i] = abs(b[i]) % mn;
    }
    for (int i = 0; i < mn; i++) {
        v[i].resize(n + 1);
        for (int j = 0; j <= n; j++) {
            v[i][j] = a[j] / mn;
            if (i < a[j] % mn)
                ++v[i][j];
        }
    }
    for (int i = 0; i < mn; i++)
        for (int j = 0; j <= n; j++) {
            cout << v[i][j] << (j == n ? '\n' : ' ');
        }
    return 0;
}
