#line 1 "main.cpp"
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, unsigned long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

#line 2 "/home/imperi/Documents/cp-library/lib/SWAG.cpp"

#line 5 "/home/imperi/Documents/cp-library/lib/SWAG.cpp"

template<typename Semigroup>
class SWAG{
  public:
  using value_t=typename Semigroup::value_t;
  using size_t=std::size_t;
  private:

  using P=std::pair<value_t,value_t>;
  std::stack<P> front,back;

  public:
  SWAG(){}

  size_t size(){return front.size()+back.size();}
  bool empty(){return size()==0;}

  value_t fold_all(){
    assert(!empty());
    if(front.empty())return back.top().second;
    if(back.empty())return front.top().second;
    return Semigroup::op(front.top().second,back.top().second);
  }

  void push_back(value_t val){
    if(back.empty())back.emplace(val,val);
    else{
      P tmp=back.top();
      back.emplace(val,Semigroup::op(tmp.second,val));
    }
  }

  void push_front(value_t val){
    if(front.empty())front.emplace(val,val);
    else{
      P tmp=front.top();
      front.emplace(val,Semigroup::op(val,tmp.second));
    }
  }

  void pop_back(){
    assert(!empty());
    if(!back.empty()){
      back.pop();
      return;
    }
    size_t n=front.size();
    std::stack<value_t> tmp;
    for(size_t i=0;i<n/2;i++){
      tmp.emplace(front.top().first);
      front.pop();
    }
    while(!front.empty()){
      push_back(front.top().first);
      front.pop();
    }
    while(!tmp.empty()){
      push_front(tmp.top());
      tmp.pop();
    }
    back.pop();
  }

  void pop_front(){
    assert(!empty());
    if(!front.empty()){
      front.pop();
      return;
    }
    size_t n=back.size();
    std::stack<value_t> tmp;
    for(std::size_t i=0;i<n/2;i++){
      tmp.emplace(back.top().first);
      back.pop();
    }
    while(!back.empty()){
      push_front(back.top().first);
      back.pop();
    }
    while(!tmp.empty()){
      push_back(tmp.top());
      tmp.pop();
    }
    front.pop();
  }
};
#line 85 "main.cpp"

struct Sum{
  using value_t=ll;
  static constexpr value_t op(value_t a,value_t b){
    return a+b;
  }
};

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll n,s;
  std::cin>>n>>s;

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

  SWAG<Sum> seq;

  ll now=0;
  constexpr ll INF=1e11;
  ll min=INF;
  rep(i,0,n){
    while(now<=i){
      seq.push_back(a[now]);
      now++;
    }
    while(now<n&&seq.fold_all()<s){
      seq.push_back(a[now]);
      now++;
    }
    if(seq.fold_all()>=s)chmin(min,seq.size());
    seq.pop_front();
  }

  if(min==INF)std::cout<<0<<"\n";
  else std::cout<<min<<"\n";

  return 0;
}



Measured memory_bytes: 5180