#include "testlib.h"
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const double pi = acos(-1.0);


int main(int argc, char ** argv) {
	registerGen(argc, argv, 1);

	if (argc != 4) {
		cerr << "Usage: n, k, seed" << endl;

		return 1;
	}

	int n = atoi(argv[1]);
	long long k = atol(argv[2]);

	vector <long long> ps;
	ps.pb(0);
	for (int i = 0; i < n - 1; i++)
		ps.pb(rnd.next(0ll, k));
	ps.pb(k);
	sort(ps.begin(), ps.end());
	vector <long long> sz(n + 1);
	for (int i = 0; i < n; i++)
		sz[i] = ps[i + 1] - ps[i];
	for (int i = 0; i < n; i++)
		if (sz[i] > i) {
			sz[i + 1] += sz[i] - i;
			sz[i] = i;
		}

	cout << n << endl;
	for (int i = 0; i < n; i++)
		cout << sz[i] << " \n"[i == n - 1];

    return 0;
}