n, m =[int(x)for x in input().split()]
res =[]
def dfs(k, m):
global res
if((k + n)*(n - k +1)/2)< m:returnif(m ==0): # 这部分是输出的内容
for i in range(len(res)-1):print(res[i],end=' ')print(res[-1])for i in range(k, n +1):if i < m - i or i == m:
res.append(i)dfs(i +1, m - i)
res.remove(i) #这句需要多加注意
dfs(1, m)
c++:
#include<iostream>#include<algorithm>
using namespace std;intdfs(int n,int k,int m,vector<int>& res){if((k+n)*(n-k+1)/2<m)return0;if(m==0){for(int i =0;i<res.size()-1;i++){
cout << res[i]<<" ";}
cout << res[res.size()-1]<<endl;}for(int i = k;i<=n;i++){if(i==m || i<m-i){
res.push_back(i);dfs(n,i+1,m-i,res);
res.pop_back();}}return0;}intmain(){int n,m;
cin>>n>>m;
vector<int> res;dfs(n,1,m,res);return0;}
python3.5 n, m = [int(x) for x in input().split()] res = [] def dfs(k, m): global res if ((k + n) * (n - k + 1) / 2) &lt; m: return if (m == 0): #...