#include <iostream>

using namespace std;

unsigned long long F[21];
int M, N;
bool f = true;
int k[1005];

void D(int m, int n, int d) {
    if (m == 1) {
        k[d] = n;
        unsigned long long c = F[N];
        for (int i = 0; i <= d; ++i) c /= F[k[i]];
        if (!f) cout << " + ";
        f = false;
        if (c > 1 || !N) cout << c;
        for (int i = 0; i <= d; ++i) {
            if (k[i]) {
                cout << "x" << (i + 1);
                if (k[i] > 1) cout << "^" << k[i];
            }
        }
        return;
    }
    for (int i = n; i >= 0; --i) {
        k[d] = i;
        D(m - 1, n - i, d + 1);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    F[0] = 1;
    for (int i = 1; i <= 20; ++i) F[i] = F[i - 1] * i;
    if (cin >> M >> N && M > 0 && N >= 0 && N <= 20) {
        D(M, N, 0);
        cout << '\n';
    }
    return 0;
}