#include <bits/stdc++.h>
#include "testlib.h"
 
using namespace std;
 
constexpr int max_n = 2e5;
 
auto read_output(InStream &stream, int n)
{
    return stream.readInt(1, n, "output");
}
 
auto read_input(InStream &stream)
{
    stream.readInt(0, 0, "t");
    stream.readEoln();
    const auto n = stream.readInt(1, max_n, "n");
    stream.readEoln();
 
    const auto cards = stream.readInts(n, 1, n, "cards");
    stream.readEoln();
    stream.readEof();
 
    return cards;
}
 
int main(int argc, char *argv[])
{
	registerInteraction(argc, argv);
 
    auto cards = read_input(inf);
    const auto j = read_output(ouf, cards.size());
 
    rotate(cards.begin(), cards.begin() + j, cards.end());
    cards.pop_back();
 
    tout << j << endl;
 
    tout << cards.size() << endl;
 
	for (int i = 0; i < (int) cards.size(); i++)
	{
		tout << cards[i];
 
		if (i + 1 != cards.size())
			tout << ' ';
	}
 
    tout << endl;
}
