#include<bits/stdc++.h>
using namespace std;
#define name "test"
#define ll long long

ll a[100005];
int main()
{
     ios_base::sync_with_stdio(0);
     cout.tie(0);cin.tie(0);
     int n, S; cin >> n >> S;
     for(int i = 1; i <= n; i++){
          cin >> a[i];
     }
     int dodai = 1e9, kq1 = 0, kq2 = 0;

     for(int l = 1; l <= n; l++){
          ll sum = 0;
          for(int r = l; r <= n; r++){
               // doan con [l, r]
               sum = sum + a[r];
               // sum tu [l, r]

               if(sum >= S){
                    if(dodai > r - l + 1){
                         dodai = r - l  + 1;
                         kq1 = l;
                         kq2 = r;
                    }
               }
          }
     }


     cout << dodai << endl;
     for(int i = kq1; i <= kq2; i++){
          cout << a[i] << " ";
     }

}









