Array problem - help regarding approch

what should be the approach of the problem

ques-https://codeforces.com/contest/435/problem/A

Hi @hunt
u can refer to dis code:

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

int main()
{
ll n,m;
cin>>n>>m;
ll s=0;
ll ans=1;
for(ll i=0; i<n; i++){
ll a;
cin>>a;
s+=a;
if(s<=m){
continue;
}
else{
ans++;
s=a;
}
}
cout<<ans<<endl;
}
if u didn’t understand something in dis code, u can post ur doubt here