text: nnumber of subarry with sum x.cpp
  // https://cses.fi/problemset/task/1660/
  #include<bits/stdc++.h>
  using namespace std;
  void __print(long long x) {cerr << x;}void __print(unsigned long long x) {cerr << x;}void __print(long double x) {cerr << x;}
  void __print(char x) {cerr << '\'' << x << '\'';}void __print(const char *x) {cerr << '\"' << x << '\"';}
  void __print(const string &x) {cerr << '\"' << x << '\"';}
  void __print(bool x) {cerr << (x ? "true" : "false");}
  template<typename T, typename V>
  void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  template<typename T>
  void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  void _print() {cerr << "]\n";}
  template <typename T, typename... V>
  void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  #ifndef ONLINE_JUDGE
  #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
  #else
  #define debug(x...)
  #endif
  #define int long long int
  #define double long double
  #define fix_precision(n) cout<<fixed<<setprecision(n)
  #define all(a) a.begin(),a.end()
  const double pi=acos(-1.0);
  int inf=0x3f3f3f3f3f3f3f3f;
  const int mod=1e9+7;
  // const int mod=998244353;
  const int mx=5*1000000;//5*64M bit ->5*8M byte ->40MB size for long long int (64 bit)
  int32_t main()
  {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      #ifndef ONLINE_JUDGE
          freopen("input.txt","r",stdin);
          // freopen("output.txt","w",stdout);
      #endif
          int n,k;
          cin>>n>>k;
          int ans=0,cur=0;
          map<int,int>cnt;
          for(int i=0;i<n;i++){
              int in;
              cin>>in;
              cur+=in;
              if(cur==k){
                  ans++;
              }
              ans+=cnt[cur-k];
              cnt[cur]++;
          }
          cout<<ans<<endl;
  }
  //always use s.lower_bound instead of lower_bound(all(s))
  //also whenever there exist an standerd method for stl container prefer that
  //otherwise this will happen
  //https://codeforces.com/contest/1435/submission/96683823//tle
  //https://codeforces.com/contest/1435/submission/96703923//accepted