#import using namespace std;int x,X,o,a;main(){for(cin>>a>>X;cin>>a;x=a){if(X<0)a+=30-X;o+=max(0,min(abs(X),a)-max(max(0,x),a-30));}cout<