#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main(){
    ll N,x;
  	vector<ll> a;
  	cin >> N >> x;
  	ll ans = 0;
  	a.resize(N);
    for(int i = 0; i < N; ++i){
      cin >> a[i];
    }
  	for(int i = 0; i < N; ++i){
      if(x >= a[i]){       
        if(i == N - 1 && x > a[i]) --ans;
        ++ans;
        b -= a[i];
      }
    }
  	cout << ans << endl;
}